I want to merge some lines with conditions but nothing seems to done . Here is the query :
drop table if exists touches_diameter_material; create table touches_diameter_material as select a.*,st_union(a.geom,b.geom) as fusion from pipe a, pipe b where a.id > b.id and a.material = b.material and a.diameter = b.diameter and st_touches(a.geom,b.geom)
if you know how to do it I'll be pleased to get some help.