I have these Data:-
———————– 1 ———————————————————
select Com.CountryName+', '+Cm.CityName+', '+Fac.FacilityName+', '+FM.FloorCode as Details
from MC_MeetingRoom_Master MR join MC_Floor_Master FM on MR.FloorID=FM.FloorID AND FM.IsActive=1
JOIN MC_Building_Master BM on BM.BuildingID=FM.BuildingID AND BM.IsActive=1
JOIN MC_Facility_Master Fac on BM.FacilityID=Fac.FacilityID and Fac.IsActive=1
join MC_City_Master Cm on Fac.CityID = Cm.CityID and Cm.IsActive=1
join MC_Country_Master Com on Cm.CountryID=Com.CountryID and Com.IsActive=1
WHERE MeetingRoomID=1000
The above query shows:-
India, Chennai, CHN - DLF Infocity - SEZ, 3rd Floor
————————– 2 ————————————————————-
Another table where
select [MeetingRoomID],[Capacity],[MeetingRoomVNET],
CASE WHEN [HasProjector] =0 then 'No'
ELSE 'Yes'
END [HasProjector],
CASE WHEN [HasLan]=0
then 'No'
ELSE 'Yes'
END [HasLan],
CASE WHEN [HasComputer]=0
then 'No'
ELSE 'Yes'
END [HasComputer],
CASE WHEN [HasWhiteBoard]=0
then 'No'
ELSE 'Yes'
END [HasWhiteBoard],
[MeetingRoomAdminMail]
from MC_MeetingRoom_Master
where [MeetingRoomID]=1023
The above query shows columns:-
1023 25 0 No No No No Admin.Helpdesk@cognizant.com
But i wanted to join both the queries…??
Do i need to create stored procedures..??
The second query is picking up a few extra columns from the same table (MuC_MeetingRoom_Master) which is used in the first query (in the first join).
By joining both the queries, I am assuming you want the join conditions that are present in the first query to remain. In that case, all you have to do is add the list of columns that are being selected in the second query to the list of the columns that are selected in the first query.