Re: select count of all overlapping geometries and return 0 if none. - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: select count of all overlapping geometries and return 0 if none.
Date
Msg-id 200903132143.24730.peter_e@gmx.net
Whole thread Raw
In response to select count of all overlapping geometries and return 0 if none.  (Duffer Do <dufferdo25@yahoo.com>)
List pgsql-sql
On Thursday 12 March 2009 19:28:19 Duffer Do wrote:
> I want to return the following:
> locations    |  number_visits
> Frankfurt    |  6
> Manhattan  |  3
> Talahassee |  0
>
> My query only returns:
> Frankfurt    |  6
> Manhattan  | 3

> My query:
> SELECT count(user_name) as number_visits, location_name from locations,
> user_tracker WHERE user_geometry && location_geometry

I think something like this:

SELECT count(user_name) as number_visits, location_name FROM locations LEFT
JOIN user_tracker ON (user_geometry && location_geometry)



pgsql-sql by date:

Previous
From: Mina R Waheeb
Date:
Subject: Re: Permanent alias for postgresql table
Next
From: Greenhorn
Date:
Subject: Oracle to PostgreSQL