[OSM-dev] query to the database matching ids without certain key

Stephan Knauss osm at stephans-server.de
Sun Aug 9 20:27:00 BST 2009


I imported the osm data into postgres.

How would I select all nodes from the database which do not have a 
certain attribute? The last time I worked with SQL is long ago, I could 
need a bit help.

I want to get for example all airport nodes that miss a name.

I can select all airports:
select node_id from node_tags where v='aerodrome'

I can get all names:
select v as name from node_tags as name, (select node_id from node_tags 
where v='aerodrome') as airports
where name.node_id=airports.node_id and name.k='name'

But how would I select all node_id for which there is no name?

Some help would be great...

Stephan




More information about the dev mailing list