我有這些數據: -如何加入Sql查詢?
----------------------- 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
以上查詢顯示: -
India, Chennai, CHN - DLF Infocity - SEZ, 3rd Floor
-------------------------- 2 ---------- -------------------------------------------------- -
另一張表
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
上面的查詢顯示列: -
1023 25 0 No No No No [email protected]
,但我想加入這兩個疑問...?
我需要創建存儲過程嗎?
您可以格式化此代碼,使其可讀? – tenfour 2012-07-21 11:01:44