How do I parse a dash-delimited value in a SQL table and use the different parsed-out values to do lookups in other tables?
Say I have users.nationality, which is a varchar like "41-33-11". I have the country, city and state tables keyed to those ids, 41 ("Buffalo"), 33 ("NY") and 11 ("USA").
SELECT users.name, users.email, users.nationality FROM users
nationality = "41-33-11"
How do I craft a SELECT statement so to get "Buffalo, NY, USA"?