[Hampshire] SQL SELECT query.

Top Page

Reply to this message
Author: Philip Stubbs
Date:  
To: Hampshire LUG Discussion List
Subject: [Hampshire] SQL SELECT query.
Hi,

I have been playing with mapnik to create some maps. It has been fun,
but I am a bit lacking in Postgres SQL. Can anybody help me to adjust
the following SELECT statement so that it will return a result set
that consists of only one of each distinct 'name'?

 SELECT way,highway,aeroway,name,ref,char_length(ref) AS length,
ST_Length(way) AS road_len,
       CASE WHEN bridge IN ('yes','true','1') THEN 'yes'::text ELSE
bridge END AS bridge
       FROM planet_osm_line
       WHERE waterway IS NULL
         AND leisure IS NULL
         AND landuse IS NULL
         AND (name IS NOT NULL OR ref IS NOT NULL)
         ORDER BY road_len DESC


Thank you all.
--
Philip Stubbs