qazi_nomi,
That won't work, would result in this error, as aggregate functions cannot be used in where.
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.
Alex,
You can do it that way, as mentioned in your post. Otherwise, you can store them into TempTable and pick the max from there.
Hope that helps.
Cheers!
_________________________
-Vijay G

Strive for Perfection
