ParentID Name in a Tree Table

0

I have an SQL table with Continents, Countries, Regions, Cities.

Continents have parentID = 0 , countries have parentID = continentID , regions have parentID=countryID and cities have parentID=regiaoID , continentID, countryID e regiaoID are the same column with name KeyID (a KeyID for each row in the table).

Each line has a description (name) in the ResourceName column. I need to do a query in which I enter a name and need to have my column ResourceName be LIKE '%{pesquisa}%' .

The string I have, and returns all occurrences, is this:

SELECT numkeyid
      ,varresourcelevelname
  FROM geolocations
 WHERE varresourcelevelname LIKE '%{pesquisa}%'

I meant that in% w / o there was something like SELECT , where query saw ParentName and searched for its name. Is it possible to do this using the table structure?

    
asked by anonymous 14.06.2018 / 14:08

0 answers