I have a table like the following...
id | subID | LoggedDateTime
1 1 2004-12-03 12:03:01
1 2 2004-12-03 12:04:42
1 3 2004-12-03 12:04:49
2 1 2004-12-03 12:03:22
2 2 2004-12-03 12:03:44
I want to be able to select only rows where the highest subID of each id has a LoggedDateTime of say 2004-12-03 12:04:45 or less. But I need all rows of the id or none..
so the magical query would return:
id | subID | LoggedDateTime
2 1 2004-12-03 12:03:22
2 2 2004-12-03 12:03:44
not...
id | subID | LoggedDateTime
1 1 2004-12-03 12:03:01
1 2 2004-12-03 12:04:42
2 1 2004-12-03 12:03:22
2 2 2004-12-03 12:03:44
appreciate your help.
thanks