Re: GROUP BY question

From: Carlos Bromanski <cbroman_at_shpamcore.com>
Date: Wed, 18 Apr 2001 20:37:10 -0500
Message-ID: <3ade40cb$0$12821$1dc6e903_at_news.corecomm.net>


SELECT Whse, CustPN, Price
FROM ThatTable AS A
WHERE Price = (

    SELECT max(Price), CustPN
    FROM ThatTable AS B
    WHERE B.CustPN = A.CustPN
    GROUP BY CustPN)

Dan Star <danstar_at_engman-taylor.com> wrote in message news:3ade0e70$0$14446$272ea4a1_at_news.execpc.com...
> Given a table like:
>
> Whse CustPN Price Notes
> 208 34512 6.50 called to expedite on 4/2
> 209 34512 7.50
> 210 34512 7.00
> 208 55555 2.00
> 209 55555 1.50 last receiving on 4/6 was damaged
>
> is there a way to use SQL to GROUP BY CustPN MAX(Price) and return
>
> 208 55555 2.00
> 209 34512 7.50
>
> Dan
Received on Thu Apr 19 2001 - 03:37:10 CEST

Original text of this message