Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Last function

Author  Topic 

Rita Bhatnagar
Posting Yak Master

172 Posts

Posted - 2001-05-02 : 13:33:27
What is the best way to replace last in this query.I used Max an it works fine but i don't know it's right or not.

SELECT MDS2.CareRecipientID AS CRID, MDS2.MDSID AS LatestMDSID, Last(MDS2_R.RQ2bDate) AS LatestMDS2CompleteDate
FROM MDS2 LEFT JOIN MDS2_R ON MDS2.MDSID = MDS2_R.MDSID
WHERE (((Len(Trim(([RQ2bDate]))))>0))
GROUP BY MDS2.CareRecipientID, MDS2.MDSID
HAVING (((Last(MDS2_R.RQ2bDate))<[PeriodEndDate]))
ORDER BY Last(MDS2_R.RQ2bDate) DESC;


   

- Advertisement -