how to do a query of subtraction?

X

xxxxxxx

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
......
 
J

Jerry Whittle

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.
 
M

Michel Walsh

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top