hi all,
I have a query i've written which almost works the way i want it to. Here's the query:

Code:
select distinct users.userid, vdn, [OrigDate] FROM QwestData, users
WHERE (
   (users.addeddate >= [OrigDate])
   AND (users.addeddate < [OrigDate]+1)
   AND (ani = users.homephone)
   AND ( (ISNULL(password, '') = '') OR (password like '9999%%') )
   AND (IsNull(leadNumber, '') = '')
   )
Problem here is that i want only one record per userid. However there can be multiple records since each userid might have more then one vdn value associated with it.

How do i modify this query so that if there's more then one record per userid, it returns only the first one based on the OrigDate (which is a datetime column) ? And it's also possible the origdate value will be the same for multiple records for the same user. In that case, i dont care which one i get.

thanks