Hello there, first of all, my english isn't good, hope you understand what I mean.
I have a table name "p" like that: mysql> select * from p; +-------+-------+--------+ | id | price | vendor | +-------+-------+--------+ | OG012 | 40 | a | | OG012 | 20 | b | | OG012 | 20 | c | | OG013 | 40 | c | +-------+-------+--------+ and I have another table name q: mysql> select * from q; +--------+--------+ | vendor | rating | +--------+--------+ | a | 1 | | b | 2 | | c | 3 | +--------+--------+ My question is how do I find the minimal price for each id and vendor rating is highest. I wish my result is: +-------+-------+--------+ | id | price | vendor | +-------+-------+--------+ | OG012 | 20 | b | | OG013 | 40 | c | +-------+-------+--------+ Since vender b and c are the same price for id(OG012), but vendor b has minimal rating then vendor c. Many thanks, Joe. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]