【发布时间】:2016-11-24 10:07:55
【问题描述】:
我想按产品找出具有最大日期的行,
我想通过 product_id 找出行的最大日期
我尝试了 DISTINCT 但无法成功!
【问题讨论】:
-
select * from product p where not exists (select * from product x where x.product_id = p.product_id and x.pdate > p.pdate);
标签: sql postgresql greatest-n-per-group