how to do a query of subtraction?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a table in ACCESS like this,
termperautre
3 (T1)
4 (T2)
5 (T3)
3 (T4)
6 (T5)


I want the value of the next cell subtracts the value of the first cell and
show the results in another column for me. So what I mean here is that I want
to know how to write a query so that the ACCESS can give me a column that has
temperature change
T2-T1
T3-T2
T4-T3
......

Can you help? Thanks
......
 
Databases don't have cells. They have fields and records. Excel has cells and
probably would be the best tool for your job. Consider exporting the data to
Excel and working with it there.
 
Hi,



Assuming the fields are f1 and f2, and that the table name is myTable:


SELECT b.f1, b.f2, a.f2, b.f2-a.f2
FROM myTable As a INNER JOIN myTable As b ON a.f1+1 = b.f1


would do. The result will be


b.f1 b.f2 a.f2 b.f2-a.f2
2 t2 t1 t2-t1
3 t3 t2 t3-t2
4 t4 t3 t4-t3
....



Hoping it may help
Vanderghast, Access MVP
 
Back
Top