Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Q: select query - I want one row to be unique

Re: Q: select query - I want one row to be unique

From: Adam Rothberg <adamr1000_at_hotmail.com>
Date: 7 Aug 2001 05:33:03 -0700
Message-ID: <68326679.0108070433.6b2187c1@posting.google.com>

here's one way...

select product, price
from T a
where mydate = (select max(mydate) from T b where a.product = b.product)

jacob_nordgren_at_hotmail.com (Jacob Nordgren) wrote in message news:<47c6b9be.0108070125.21f353e0_at_posting.google.com>...
> Hi,
>
> I have this data
>
> PRODUCT PRICE MYDATE
> 1 12 2001-08-01
> 1 13 2001-08-07
> 2 14 2001-08-03
>
> I want to get a list of all the products with the latest price only
> (no duplicate products). I know how to do the query without the price
> part:
>
> "SELECT PRODUCT, MAX(MYDATE) FROM T GROUP BY PRODUCT" works fine.
>
> How can I include the PRICE column into the result?
>
> / Jacob
Received on Tue Aug 07 2001 - 07:33:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US