Please find the attached file for the table export data. It has id, name and containingregion columns.
containingregion column has id which connects to other location in the same table.
My problem here is when I give an id I need to get country for that id and continent for that ID in two queries. my problem here is some times the ID might be county record, some times the ID might be state ID..when I give ID I need to get country, state and continent. if the id is country id, then I need to get state as null, country as this record and continent should be the continent of the record.
I need it in three queries, one for state, one for country and one for continent. Please let me know how can I do it.