Reputation: 1559
tblCurrent_locations
Id BusNo Date Time
1 mh30q121 2009/12/18 11:00:00
2 mh30q121 2009/12/18 1245:30
3 mh30q121 2009/12/18 11:30:00
4 mh30q121 2009/12/18 1015:00
5 mh30q121 2009/12/18 11:00:00
6 mh30q121 2009/12/19 13:00:00
7 mh30q121 2009/12/19 13:15:30
8 mh30q121 2009/12/19 14 15 39
9 mh30q121 2009/12/19 12:30:00
10 mh30q121 2009/12/20 14:00:30
11 mh30q121 2009/12/20 14:08:00
12 mh30q121 2009/12/20 14:02:30
13 mh30q121 2009/12/20 14:4:00
14 mh30q121 2009/12/20 14:04:30
15 mh30q121 2009/12/20 14:07:00
16 mh30q121 2009/12/20 14:07:30
Here I want to retrieve last n records sorted by date and time.
Upvotes: 0
Views: 1735
Reputation: 31892
SELECT TOP n * FROM tblCurrent_locations ORDER BY "Date" DESC, "Time" DESC
EDIT
As gbn noticed
SELECT TOP n * FROM tblCurrent_locations ORDER BY [Date] DESC, [Time] DESC
doesn't rely on other settings.
Upvotes: 3