Please help me with this query

hmho

Registered User.
Local time
Yesterday, 21:37
Joined
Apr 7, 2009
Messages
93
I have table that has this data below. Basically I would like to find the diffrence between the End_No for today and previous day. For example between 04/07/09 and 04/06/09 the diffrence for End_No is 50-40=10.
Please don't laugh I'm new to Access.
Thanks:confused:


Date G_No End_No

04/05/09 123 35
04/06/09 123 40
04/07/09 123 50
 
You should be able to do this using sub-queries. This link may be of some use.
 
I'm realy confuse can you give example.

Thanks
 
Something like the following (substituting highlighted text with actual table/field names):
Code:
SELECT T1.[B][I]Date[/I][/B], Min(T1.[B][I]End_No[/I][/B]) - (SELECT MAX(T2.[B][I]End_No[/I][/B])
                                  FROM [B][I]MyTable[/I][/B] AS T2
                                  WHERE T2.[B][I]Date[/I][/B] < T1.[B][I]Date[/I][/B]) AS End_No_Diff
FROM [B][I]MyTable[/I][/B] AS T1
GROUP BY T1.[B][I]Date[/I][/B];
 

Users who are viewing this thread

Back
Top Bottom