[Gdal-dev] inner join

Richard Greenwood richard.greenwood at gmail.com
Thu Apr 28 23:17:19 EDT 2005


I am trying to create a destination shape file that is a sub-set of a
source shape file, based on a join to a dbf.

Poly.shp is the source shape file. Listing.dbf has the list of records
that I want from poly.shp.

In pseudocode  I want something like:
   Select * from poly where id in (select id from listing)
Or:
   Select * from poly where poly.id = listing.id

But I keep getting all of the records from poly (the source table) my
statement is as follows:

ogr2ogr -sql 
"SELECT * FROM poly LEFT JOIN '/map_data/listings/listing.dbf'.listing 
ON poly.Id = listing.Id" 
test1 /map_data/wy83-wf/poly.shp

It seems like I need to change LEFT JOIN to INNER JOIN, but that does
not appear to be supported. I tried to re-order my JOIN ... ON clause,
but with no joy.

Any suggestions would be appreciated.

Rich
-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the Gdal-dev mailing list