That won't work. For each resellerid, you'll get the minimum price and an
effectively random offerid.
Michael
Daniel Lahey wrote:
You need to use the 'GROUP BY' clause:
SELECT offerid, resellerid, MIN(price) FROM A GROUP BY resellerid;
Cheers,
Dan
On Jul 30, 2004, at 2:37 PM, 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]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]