我有一张桌子叫Tb_patientBeds
.
现在我想根据该表中的列检索设置为占用、未占用或全部的记录。status
这是我的其他专栏:
patientBedID int IDENTITY(1,1) NOT NULL,
patientBedType [varchar](20) NULL,
BedCharge [varchar](20) NULL,
status [varchar](20) NULL,
我写了这样的查询
select * from Tb_patientBeds where [status]= case
when [status]= '0'
then 'occupied'
when [status]='1'
then 'unoccupied' else 'All'
end
查询没有返回记录,它显示的是空记录。
有人可以在这方面帮助我吗?