[postgis-users] OT: Help with a join
Burgholzer,Robert
rwburgholzer at deq.virginia.gov
Mon Jun 30 08:28:23 PDT 2008
You need to use a LEFT OUTER JOIN, like so (although I am only doing the
simple case of joining "edges" and "addr", but you can probably extend
it to your full case):
SELECT a.tlid, c.fromhn, c.tohn, c.side,
c.zip, c.plus4, a.statefp, a.countyfp
FROM edges a LEFT OUTER JOIN addr AS c ON (a.tlid=c.tlid )
Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Stephen Woodbridge
Sent: Monday, June 30, 2008 12:17 PM
To: PostGIS Users Discussion
Subject: [postgis-users] OT: Help with a join
Hi all,
I could use a little help with a join:
select a.tlid, b.fullname, b.paflag, a.mtfcc, c.fromhn, c.tohn, c.side,
c.zip, c.plus4, a.statefp, a.countyfp
from featnames b, addr c, addrfn d, edges a
where a.tlid=b.tlid and b.tlid=c.tlid and b.linearid=d.linearid and
c.arid=d.arid and a.roadflg='Y'
order by a.tlid, b.fullname, c.side ;
I need to get back records for every record in edges even if there is no
matching tlid in the addr table.
How do I do that?
Thanks,
-Steve
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list