Question : grouping by one column, and wanting another column in result

select CategoryPK, max (ValidAmtFK) as MaxValidAmt from
TABLES WHERE CONDITIONS
Group by CategoryPK

CategoryPK is more reliable than CategoryDesc
After finding max (ValidAmtFK), the only real end result I want is ValidAmt value.

So I need CategoryDesc, ValidAmt as the resultset.

But I need to group by CategoryPK and do max (ValidAmtFK) and not max (ValidAmt)

Is the only option to bring this is to have another level of Joins outside the above query, and making the above query as a derived table?

this is in SQL 2000.

Answer : grouping by one column, and wanting another column in result

Random Solutions  
 
programming4us programming4us