[GRASS-user] Advanced SQL Queries
Moritz Lennert
mlennert at club.worldonline.be
Wed Jun 13 05:28:37 PDT 2012
On 12/06/12 23:21, Rich Shepard wrote:
> Two tables: 'sites' contains the ID and geographic coordinates;
> 'waterchem' contains the ID and water chemistry data. The latter table is a
> sub-set of the former.
>
> I want to display only those sites for which chemistry data are available.
> In postgres I write,
>
> SELECT DISTINCT(w.site) FROM waterchem AS w
> WHERE EXISTS (SELECT s.name FROM sites AS s
> WHERE w.site = s.name);
>
> Can I submit this same query within GRASS and have the returned sites
> displayed by location? If so, is there a preferred method for doing so?
Just use everything after the first WHERE as argument for the 'where'
parameter of d.vect (or any other module with a where parameter).
Moritz
More information about the grass-user
mailing list