emorris1000
Registered User.
- Local time
- Today, 15:02
- Joined
- Feb 22, 2011
- Messages
- 125
Seemed appropriate to have a different thread for this issue, even though I have another thread for the original issue.
I have put together a nice little subquery that allows me to look at the flow of a gas over time and, by numerically differentiating time, allows me to calculate the amount of gas that has flowed over a period of time.
Here's the current query:
The query gives 2 fields, the PolyID (which are identical for all of these, they represent a single run), and the C2dT, which is the chunk where you subtract current time by previous time (the subquery) and multiply it by the EthFlow value.
From this I can create a second query where I sum the C2dT values, which is my ultimate goal. What I wanted to do was to just sum them in the same query, so I tried this:
But it won't let me do this because Time and Ethflow are not part of an aggregate function. I think I can get away with that if I mess with how I am grouping the subquery but I can't figure it out.
Any thoughts?
I have put together a nice little subquery that allows me to look at the flow of a gas over time and, by numerically differentiating time, allows me to calculate the amount of gas that has flowed over a period of time.
Here's the current query:
Code:
SELECT TestTable.PolyID,
([TestTable]![Time]-
Nz((SELECT TOP 1 Dupe.Time From TestTable AS Dupe
WHERE dupe.Time < TestTable.Time
ORDER BY Dupe.ID desc),0))
*[TestTable]![EthFlow]
AS C2dT
FROM TestTable;
The query gives 2 fields, the PolyID (which are identical for all of these, they represent a single run), and the C2dT, which is the chunk where you subtract current time by previous time (the subquery) and multiply it by the EthFlow value.
From this I can create a second query where I sum the C2dT values, which is my ultimate goal. What I wanted to do was to just sum them in the same query, so I tried this:
Code:
SELECT TestTable.PolyID,
Sum(
([TestTable]![Time]-
Nz((select TOP 1 Dupe.Time
From TestTable AS Dupe
WHERE dupe.Time < TestTable.Time
Order by Dupe.ID desc),0))
*[TestTable]![EthFlow]
)
AS C2dT
FROM TestTable
Group By PolyID;
But it won't let me do this because Time and Ethflow are not part of an aggregate function. I think I can get away with that if I mess with how I am grouping the subquery but I can't figure it out.
Any thoughts?