[Qgis-user] Help on creating a view

2008-05-29 Thread Francis Dupont
Hello! I have two tables named myPtTable and myPolyTable on a PostGIS/PostgreSQL 8.3 server. I want to join the two table based on a spatial query has following: SELECT a.gid, b.gid, a.level, b.name a.the_geom FROM myPolyTable a, myPtTable b WHERE st_contains(a.the_geom, b.the_geom) ORDER BY

Re: [Qgis-user] Help on creating a view

2008-05-29 Thread Bernhard Ströbl
Dear Francis, afaik views work in QGIS now (i.e. Version 0.10), so your second view SELECT a.gid, a.level, a.the_geom FROM myPolyTable a should definitely work. However your first view lacks a primary-key field, neither a.gid nor b.gid are unique if you really have a n to m join. What do you want

Re: [Qgis-user] Help on creating a view

2008-05-29 Thread Jürgen E . Fischer
Hi Francis, On Thu, 29. May 2008 at 07:40:22 -0700, Francis Dupont wrote: SELECT a.gid, b.gid, a.level, b.name a.the_geom FROM myPolyTable a, myPtTable b WHERE st_contains(a.the_geom, b.the_geom) ORDER BY a.level, a.gid; You could may get away with: SELECT (a.gid::int832)+b.gid::int8 as