Re: GROUP BY question

From: Dan Star <danstar_at_engman-taylor.com>
Date: Thu, 19 Apr 2001 11:03:09 -0500
Message-ID: <3adf0c63$0$18888$272ea4a1_at_news.execpc.com>


Carlos,

I had to remove CustPN from the SELECT clause in the sub query and then it worked in Access97.

Thanks,
Dan

Carlos Bromanski wrote:
>
> 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 - 18:03:09 CEST

Original text of this message