Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesHi, I have a table with composite key: ID1 and ID2 and it also has a priority field. I want to get all the information for all records with the minimum priority group by ID2. How can I achieve that? Thanks. Donna
Post Follow-up to this messagePost table structures, sample data and the result you want Madhivanan
Post Follow-up to this messagespecifically when I do the following, I lose id2: select min(priority) as priority, id1 from table t group by id1 I want it to return id1, id2, priority where it is the min(priority) group by id1
Post Follow-up to this messageTry this Select T1.id1,T1.id2,T2.priority from tablet T1 inner join (select min(priority) as priority, id1 from table t group by id1 ) T2 on t1.id=T2.id and t1.id2=T2.id2 Madhivanan
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread