prairiedog
asked on
select latest records based on datetime
I have a log table like this:
username productID purchasetime
-------------------------- ---------- ---------- -----
user1 12 01/02/1999
user1 12 03/05/2000
user2 23 02/03/2000
user2 31 02/04/2000
user2 23 02/04/2000
....
I want to select users that purchased product later than a predefined time, say 01/01/1998, but if a user purchase a same product at different dates, then only the latest one will be selected. How to write the query? Thanks a lot.
username productID purchasetime
--------------------------
user1 12 01/02/1999
user1 12 03/05/2000
user2 23 02/03/2000
user2 31 02/04/2000
user2 23 02/04/2000
....
I want to select users that purchased product later than a predefined time, say 01/01/1998, but if a user purchase a same product at different dates, then only the latest one will be selected. How to write the query? Thanks a lot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Jeffrey Zheng