crujazz
06-14-2009, 11:22 PM
Hello everybody, I'm new here.
I do have a little problem calculating in a query.
I have a query with 4 coloms (colom 1 = Date, 2= Pressure Left, 3= Pressure Right, 4=Flow).
Each day i enter the date, and the pressure.
I want to calculate the Flow.
Example
12-06-09 Left= 300, Right = 188
15-06-09 Left= 300, Right = 170
Flow = Right 188 - Right 170 but the date aint equal, how can i make the calculation?
Thnx for ya support
ColinEssex
06-15-2009, 12:08 AM
First off, don't call a column "Date" as it is a reserved word and will cause you problems.
Secondly, what is the actual formula for calculating the flow? If you enter the pressures every day - what has happened to the 13th and 14th of June?
I'm not being picky, what I'm saying is - is the flow calculated from the "Right" pressure on the 12th then take away the "right" pressure on the 13th?
What happens if you have a negative result?
Col
gemma-the-husky
06-15-2009, 01:39 AM
its a slightly different problem, but if you need to calculate these regularly, then i would consider storing the start and finish readings on the row
so you store (effectively)
12-06-09 Left= 300, Right = 188 Previous = 170
15-06-09 Left= 300, Right = 170 Previous = 183
etc
as i say, its a slightly different problem - but doing it this way, you only need to get the previous reading once - its also properly relational, as a row of data doesnt depend on other rows.
it only becomes an issue if you need to insert data in the middle of a sequence, as this affects several stored readings
crujazz
06-15-2009, 01:52 AM
First off, don't call a column "Date" as it is a reserved word and will cause you problems.
Secondly, what is the actual formula for calculating the flow? If you enter the pressures every day - what has happened to the 13th and 14th of June?
I'm not being picky, what I'm saying is - is the flow calculated from the "Right" pressure on the 12th then take away the "right" pressure on the 13th?
What happens if you have a negative result?
Col
Dear Col, I named my first column dtmDatum
u are not picky..the flow is calculated from the right pressure
for instance last friday Pressure right was indeed 188 en today 170, the weekend the systems continues with the process but i don't collect the values until mondy morning
Regarding the negative results, we have a backup systems for the pressure (Pressure Left)
My collegaue does it in Excell and i'm trying to automate the proces of collecting data.
Cjz