psql
沉在水底的鱼
乐观开朗积极向上
展开
-
postgresql分组后获取第一条数据
-- 根据编号分组取第一条数据select * from table t where t.no=(select max(no) from table t1 where t1.no=t.no)-- 根据编号分组后取第一条数据SELECT * FROM (SELECT ROW_NUMBER() OVER (partition BY no ORDER BY no) rowId,* from table) tWHERE rowId=1...原创 2021-01-26 15:03:44 · 1894 阅读 · 0 评论 -
psql 如何一个字段为空,设置为默认值
coalesce(c.service_price,19) AS servicePrice 如果服务价格为null,设置为19元原创 2020-05-08 13:44:37 · 1451 阅读 · 0 评论