dkniffin / webtrees-openstreetmap

Openstreetmap plugin for webtrees
MIT License
14 stars 4 forks source link

Treat "N0,E0" as null in sql query #11

Closed dkniffin closed 10 years ago

dkniffin commented 10 years ago

Here's the SQL to do it.

SELECT CONCAT_WS(', ', t1.pl_place, t2.pl_place, t3.pl_place, t4.pl_place, t5.pl_place, t6.pl_place) as fqpn, COALESCE(NULLIF(t1.pl_long,'E0'), NULLIF(t2.pl_long,'E0'), NULLIF(t3.pl_long,'E0'), NULLIF(t4.pl_long,'E0'), NULLIF(t5.pl_long,'E0'), NULLIF(t6.pl_long,'E0')) as pl_long, COALESCE(NULLIF(t1.pl_lati,'N0'), NULLIF(t2.pl_lati,'N0'), NULLIF(t3.pl_lati,'N0'), NULLIF(t4.pl_lati,'N0'), NULLIF(t5.pl_lati,'N0'), NULLIF(t6.pl_lati,'N0')) as pl_lati FROM ##placelocation as t1 LEFT JOIN ##placelocation as t2 on t1.pl_parent_id = t2.pl_id LEFT JOIN ##placelocation as t3 on t2.pl_parent_id = t3.pl_id LEFT JOIN ##placelocation as t4 on t3.pl_parent_id = t4.pl_id LEFT JOIN ##placelocation as t5 on t4.pl_parent_id = t5.pl_id LEFT JOIN ##placelocation as t6 on t5.pl_parent_id = t6.pl_id HAVING fqpn=?;

dkniffin commented 10 years ago

I think I fixed this with 421a9d0

dkniffin commented 10 years ago

Confirmed