Search Postgresql Archives

Re: SQL Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GIROIRE, Nicolas (COFRAMI) wrote:
For the first request (How can i select only the newest record for each ProdId ?), you can do :

select * from test."tableProd" u
where u."LastUpdate" = (select max(t."LastUpdate") from test."tableProd" t
where u."ProdId" = t."ProdId")

Although this only guarantees one row if LastUpdate is unique for every ProdId.
--
Richard Huxton
Archonet Ltd


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux