G
Guest
I have a table recording monthly reading. How do I get the reading for last
month?
Any reply is highly appreciated.
month?
Any reply is highly appreciated.
I have a table recording monthly reading. How do I get the reading for last
month?
Any reply is highly appreciated.
The table has four fields, CustomerID, Year, Month and Reading. How can I get
the latest reading for every customer.
Thanks.
John Vinson said:The table has four fields, CustomerID, Year, Month and Reading. How can I
get
the latest reading for every customer.
Thanks.
SELECT CustomerID, CDate("1/" & [Month] & "/" & [Year]) As
ReadingDate, [Year], [Month], [Reading] FROM yourtable;
John Vinson said:The table has four fields, CustomerID, Year, Month and Reading. How can I
get
the latest reading for every customer.
Thanks.
SELECT CustomerID, CDate("1/" & [Month] & "/" & [Year]) As
ReadingDate, [Year], [Month], [Reading] FROM yourtable;
CDate() is one of the few date-related functions that respects the user's
Regional Settings. Assuming their Short Date format set to anything other
than dd/mm/yyyy, your formula won't work: all the dates they'll get will be
in January in all cases.
SELECT CustomerID, DateSerial([Year], [Month], 1) As
ReadingDate, [Year], [Month], [Reading] FROM yourtable;
avoids that problem.