There are possibly 3 ways, depending on your version of mysql. The manual <http://dev.mysql.com/doc/mysql/en/example-Maximum-column-group-row.html> has details for selecting the rows with the groupwise maximum. Changing that to groupwise minimum should be trivial.

Michael

Haitao Jiang wrote:

Hi, there

Maybe this question is not MySQL specific, but I just wondering if
MySQL has any way to doing this:

I have a table A like following:

offerId resellerId price
------------------------------
1        r1           5
2        r1          10
3        r2          12
4        r2           4
------------------------------

How can I select only one row from each reseller with the the lowest
price from this reseller? i.e. the result should be
1  r1  5
4  r2  4

Thanks in adavnce



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to