大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说Postgrsql 使用CASE WHEN解决不定列问题[通俗易懂],希望您对编程的造诣更进一步.
SELECT WIDTH_BUCKET( public.ST_X ( geom ),107.63636363636364,114.90916363636364,10 )
grid_x,WIDTH_BUCKET( public.ST_Y ( geom ),25.454545454545457,29.090981818181824,5 )
grid_y,COUNT ( * ) count,public.ST_X(public.ST_CENTROID ( public.ST_COLLECT ( geom ) )) center_x,
public.ST_Y(public.ST_CENTROID ( public.ST_COLLECT ( geom ) )) center_y,
case when COUNT (*)<6 then ARRAY_AGG ( pk_uid ) end pk_uid
FROM hngsmmzt.hngs_gsmm_pt
WHERE 1=1 and geom is not null AND
public.ST_X( geom ) BETWEEN 107.63636363636364 AND 114.90916363636364
AND public.ST_Y( geom ) BETWEEN 25.454545454545457 AND 29.090981818181824
AND shzt="2" GROUP BY grid_x,grid_y
代码100分
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/9873.html