Retrive the names in the country,state,cites,state,cites,Country,state,cites by passing record id
Hi have the following table structure.RecordTable
=========
rid int identity primarykey
Name nvarchar(250)
Country
======
ContryId int identity primarykey
Name nvarchar(250)
rid forenkey to recordTable
State
======
stateId int identity primarykey
Name nvarchar(250)
ContryId forenkey to countryTable
City
======
cityid int identity primarykey
Name nvarchar(250)
stateId forenkey to countryTable
Now I want retrieve all the name of country,state,cites,state,cites,Country,state,cites by passing rid
The data will be like this
Names
==============
Country1
State1
city1
city2
city3
State2
city1
city2
city3
Country2
State1
city1
city2
city3
Country3
State1
city1
State2
city1
State3
city1
Any one please give the union query to retrieve the data.
Regards,
Koti.