630 bytes added,
17:01, 10 February 2014 <pre>SELECT
gazetteer.gazetteer_localid,
gazetteer.gazetteername,
gazetteerlevel.level
FROM
gazetteer
Inner Join gazetteerlevel ON gazetteer.gazlevel_guid = gazetteerlevel.gazlevel_guid
WHERE
gazetteer.parentgazetteer_guid IS NULL AND
gazetteerlevel.seqno <> '1'
This query has to be verified
SELECT
Child.gazetteername,
gazetteerlevel.seqno
FROM
gazetteer AS Child
Left Join gazetteer AS Parent ON Child.parentgazetteer_guid = Parent.gazetteer_guid
Inner Join gazetteerlevel ON Child.gazlevel_guid = gazetteerlevel.gazlevel_guid
WHERE
gazetteerlevel.seqno <> '1' AND
Parent.gazetteer_guid IS NULL
</pre>
[[Category:NoPublic]]