标签:sys rom sel com object lse comm case when ges
SELECT
(CASE
WHEN News_Data.Type = 1 THEN (SELECT Sys_Department.Name FROM Sys_Department WHERE Sys_Department.Id = News_Data.ObjectId)
WHEN News_Data.Type = 2 THEN (SELECT Basic_Community.Name FROM Basic_Community WHERE Basic_Community.Id = News_Data.ObjectId)
WHEN News_Data.Type = 3 THEN (SELECT Basic_Property.Name FROM Basic_Property WHERE Basic_Property.Id = News_Data.ObjectId)
WHEN News_Data.Type = 4 AND ObjectId != ‘00000000-0000-0000-0000-000000000000‘ THEN (SELECT Basic_HousingEstate.Name FROM Basic_HousingEstate WHERE Basic_HousingEstate.Id = News_Data.ObjectId)
WHEN News_Data.Type = 4 AND ObjectId = ‘00000000-0000-0000-0000-000000000000‘ THEN ‘‘
ELSE ‘‘
END
)ObjectName,*
FROM News_Data WHERE State= 1
标签:sys rom sel com object lse comm case when ges
原文地址:https://www.cnblogs.com/JAVA-BK/p/12111207.html