this is my table snapshot of sql server.
i want to write a sql query , which will return only 3 row, whcih contain max offer from 3 diffrent category. like in my result there should be 3 different category id, and correspondence to that category's Offer that offer should be maximum in that category
this is my desired output
you can see there is 3 diffrent category , and offer belongs to that category is maximum from that category

SUNIL GUTTAPosted Mar 5, 2014, 6:46 AM
Is so query will be like
select distinct(cat_id), max(offer),columns_1.... whatever u need ..
from table_A
group by cat_id;
Regards