【发布时间】:2022-01-08 08:59:38
【问题描述】:
对于以下查询,我只需要选择具有最低 shape_type 值(范围从 1 到 10)的第一条记录。如果你有任何关于如何轻松做到这一点的知识是 postgresql,请帮助。谢谢你的时间。
select g.geo_id, gs.shape_type
from schema.geo g
join schema.geo_shape gs on (g.geo_id=gs.geo_id)
order by gs.shape_type asc;
【问题讨论】:
标签: sql postgresql distinct greatest-n-per-group distinct-on