theyI had a asp.net (vb) web application to store work overtime (OT) records.
In SQL server, the OT table likes this, e.g.:
ot_key | From Time | To Time | total_min
12 | 2011-09-22 10:00 | 2011-09-22 13:00 | 180
13 | 2011-09-24 14:00 | 2011-09-24 15:00 | 60
14 | 2011-09-23 12:00 | 2011-09-23 14:30 | 150
15 | 2011-09-24 18:00 | 2011-09-24 19:30 | 90
As user will input previous date OT records, so the records in db will not be in sequence. the date of records#14 is before records#13.
if user want to know which OT records cover the last 2 hours, the system should retrieve record #15 (90mins) & #13 (30mins) because they covers the final 2 hours.
How to write the SQL statement to retrieve the records ? Thanks
Joe