Using SQL Server 2000
I want to get the max(date) of total for each id.
ID Date Total
01 02/01/2012 500
01 01/02/2012 1000
01 02/03/2012 350
02 17/01/2012 250
02 15/02/2012 150
03 01/12/2011 225
...
...
I want to get max(date) of total for each id.
Tried Query
Select id, total from table1 where date > max(date) group by id, total
Getting error message as
"An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference."
Expected Output
ID Date Total
01 02/03/2012 350
02 15/02/2012 150
03 01/12/2011 225
...
...
How to do this.
Need Query Help