I have 2 tables 'Session' and 'Count' , I want to retrieve the most recent Count.CountDate for any inputted Session.TrayNumber ie:
So if I inputted Tray Number = 2 then I get the most recent date for that TrayNumber = 26/03/2014
What I have at the moment will only get the MAX CountDate for all the dates in the CountDate column ie:
FROM Session, Count
WHERE Session.Session_ID = Count.Session_ID
AND Count.CountDate = (SELECT MAX(CountDate)
FROM Count WHERE Session.TrayNumber = @TrayNumber)
Hope that this makes sense and someone can help.