[postgis-users] Advanced query problem

Robert Burgholzer rburghol at chesapeakebay.net
Mon Feb 27 05:53:45 PST 2006


It seems that you are doing a join in Postgis, which does not differ
from any other regular criteria join in SQL, as Bill points out, you
will get as many copies of the geometry as you have matching record in
your 2nd table. What I believe you are hoping for is a "crosstab" type
of join perhaps, or, more appropriately a custom way of handling your
query results so that you get the information you want when you click on
your map. In that case, your best bet is to specify your mapserver layer
with just a simple query line, i.e., "the_geom from table1", and then
manage the join in the routine that handles the query results. For help
on how to do that, the mapserver forum would probably be the best bet.

 

Good lluck,

rob

 

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Krishnaa Sridharan
Sent: Sunday, February 26, 2006 6:02 PM
To: postgis-users at postgis.refractions.net
Subject: Re: [postgis-users] Advanced query problem

 

Bill thanks a lot for your reply. I did change the left join to inner
join. But the problem I am having is while trying to connect two tables
with one to many relationship. What mapeserver is doing is this,

 

Table 1 ( spatial table )
Table 2 ( postgre table)

 

These are unique numbers                                    Table to has
multiple values for the same unique number in table 1.

101
101          John

102
101         Tom

103
102         Mark

 

 

If I run the query my out put looks like this

 

101   John

101   John

102   Mark

 

Mapserver is not returning the second value from table 2 instead its
returning the same thing again. I am sorry if I have any basic things
wrong, I am really new to this and any bit of info would help thanks.

 

Kris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060227/efe5bb22/attachment.html>


More information about the postgis-users mailing list