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)
 Simple query using MAX and dates

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-06 : 14:58:36
R writes "Here is my query:

SELECT 
Project_Key_ID, Scenario_Key_ID, Facility_ID,Date_Stamp
FROM
Comparisons_Table
WHERE
Project_Key_ID='P_4_281'
GROUP BY
Project_Key_ID, Scenario_Key_ID, Facility_ID,Date_Stamp
HAVING
Date_Stamp=MAX(Date_Stamp)
ORDER BY
Date_Stamp


I am trying to get all of records based on the MAX date stamp and a project key from a table. However I am getting all of the dates, not just the greatest date. I appreciate the help!
-R-"
   

- Advertisement -