create procedure [dbo].[p_dm_GetBedByRID2]
(
@Room_ID bigint
)
AS
BEGIN
select convert(nvarchar(10),bed.BedNumber)+N'('+
(case when exists(select 1 from dmStudentInfo where Student_ID=bed.Student_ID)
then (select StudentName from dmStudentInfo where Student_ID=bed.Student_ID)
else '空' end)+N')' as BedNumber,BedInfo_ID
from dmBedInfo as bed where Room_ID=@Room_ID
END
sql case 字段整合
最新推荐文章于 2023-12-08 17:10:19 发布