Re: SELECT difficulties

2004-08-01 Thread Michael Stassen
row.html>. Michael João Paulo Freire wrote: SELECT offerid, resellerid, price FROM A WHERE price = MIN(price) GROUP BY resellerid; - Original Message - From: "Michael Stassen" <[EMAIL PROTECTED]> To: "Daniel Lahey" <[EMAIL PROTECTED]> Cc: "Haitao Jian

Re: SELECT difficulties

2004-08-01 Thread João Paulo Freire
AIL PROTECTED]> Sent: Friday, July 30, 2004 7:33 PM Subject: Re: SELECT difficulties > 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 &

Re: SELECT difficulties

2004-07-30 Thread Michael Stassen
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:

Re: SELECT difficulties

2004-07-30 Thread Daniel Lahey
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

Re: SELECT difficulties

2004-07-30 Thread Michael Stassen
There are possibly 3 ways, depending on your version of mysql. The manual has details for selecting the rows with the groupwise maximum. Changing that to groupwise minimum should be trivial. Michael Haitao Jiang wrote:

SELECT difficulties

2004-07-30 Thread Haitao Jiang
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 -- 1r1 5 2r1 10 3r2 12 4r2 4 -