I am gathering many fields from one database over many tables (6). One column is causing duplication for some of the data. I want to create a boolean for that field if one or more of my parameters is true and group by the rest of the fields.
There is a one to many relationship between the geometry table and the address table (2 sides to every road). So, the problem is that there will be one value for each side of the road, therefore multiple returns. I've played around with bool_or, case, coalesce, exists, array_agg but can't figure it out. Any ideas?
select g.country, g.id, n.name, gsc.geometry, gst.class, gst.length, gst.road_type, gst.one_way, gst.bridge, ga.add_type
from geo g
left outer join name n on (g.id = n.id)
left outer join geometry_address ga on (g.id = ga.id)
join geometry_s gst on (g.is = gst.is)
join geometry_s gs on (g.id = gs.id)
join geometry_sc gsc on (gs.gsi = gsc.gsi)
where (g.type = 'road') and (g.country = 'USA')
Thanks for your help.