Keith writes "Using SQL 2000 on Win 2000:
I have two tables using inner Joins and this is the short version,
SELECT tb1.ID, tb1.Date, tb1.Date2, tb1.xID, tb1.SRnum, tb2.FirstName, tb2.LastName, tb2.xID
FROM tb1 INNER JOIN
Tb2 ON tb1.xID = tb2.xID
WHERE (tb1.SRnum = @SRnum)
ORDER BY tb1.xID, tb1.Date DESC
Basically this will pull a list according to the where clause that looks like:
tb1.ID tb1.Date .....
What I am trying to do is get the record with the most recent date entered to display on an ASP page and also sorting by column.
What I think I need to do is filter out for the first occasion of tb1.ID and ignore the rest so I can then sort by any column. I can get the correct results sorting by LastName and filtering out the duplicates on the ASP page, but when sorting by tb1.Date it just doesn’t work without being able to do something like creating a temp table to store the first instance. I have not found a decent solution to filtering the first instance.