Joined: 18/10/2016 11:04:10
I'm having trouble creating a query that matches a geonameid to a single record in the `alternatename` table. Basically when I retrieve a "DE" translation for some entity, I want my SQL join to only return 1 match.
However, the fields `alternatename.isShortName` and `alternatename.isPreferredName` does not seem to be properly filled out. I get multiple matches per geonameid on my query, but i would like to have the following situation (returning the first record that matches the criteria):
if isPreferredName=1, then use it.
else if isShortName=1, then use that.
else, use whatever match we can find for that language code.
Any clue on how to build this query while still allowing it to be performant on a large dataset?