having对聚合函数的结果集进行过滤

SELECT rl.road_code,string_agg(distinct rs.tech_level_label, ',') from road_lst rl
left join road_section rs on rl.id = rs.road_id
where rs.tech_level_label is not null
GROUP BY rl.id
HAVING string_agg(tech_level_label, ',') like '%三级%'

posted @ 2022-12-13 14:03  懂得归零  阅读(32)  评论(0编辑  收藏  举报