hi developers
i've a table named users where i store the city id ,
this city id -> citymaster (cityid,stateid)->state master (cityid,stateid) ->country master (countryid,stateid).
now i need to make the query fetches the columns like this
username,cityid,stateid,countryid
how can i do this
Select U.UserName, C.CityID, S.StateID, CT.CountryID
From UserMaster U
Left Outer Join CityMaster C On U.CityID = C.CityID
Left Outer Join StateMaster S On C.StateID = S.StateID
Left Outer Join CountryMaster CT On S.CountryID = CT.CountryID
hope it helps./.
|||
thanks for that but i did like this
select countrymaster.countryname,countrymaster.countryidentity,
statemaster.statename,statemaster.stateidentity,
citymaster.cityname,citymaster.stateidentity,AdminUserMaster.userid,AdminUserMaster.address1,
AdminUserMaster.address2,AdminUserMaster.postcode,AdminUserMaster.email,AdminUserMaster.isactive,
AdminUserMaster.cityidentity,AdminUserMaster.dob,(AdminUserMaster.firstname+' '+AdminUserMaster.middlename+' '+AdminUserMaster.lastname)asname
from countrymaster,statemaster,citymaster,AdminUserMaster
where countrymaster.countryidentity=statemaster.countryidentity
and citymaster.cityidentity= AdminUserMaster.cityidentity