On 15.04.2005 13:58 Alex wrote:
> Hi,
>
> i have a table
>
> ProdId | LastUpdate
> -------+------------
> 100 | 2005-04-01
> 100 | 2005-03-01
> 100 | 2005-02-01
> 200 | 2005-04-01
> 200 | 2005-03-01
> 200 | 2005-02-01
>
> - How can i select only the newest record for each ProdId ?
>
> 100 | 2005-04-01
> 200 | 2005-04-01
>
SELECT prodid,
lastupdate
FROM produpdate p1
WHERE lastupdate = (SELECT MAX (lastupdate) FROM produpdate p2 WHERE p2.prodid =
p1.prodid)
Thomas