sql 多分支小问题,急啊,各位帮帮忙
select Cxzb_nr,Cxzb_dw,Cxzb_dwxb from Cxzb where
case
when @jibie= '3 ' then Cxzb_dw=@danwei
when @jibie= '2 ' then Cxzb_dw=@xuesh
else Cxzb_dw=@www
end
根据条件给出查询条件?这么写对马?该怎么写啊??
------解决方案--------------------select Cxzb_nr,Cxzb_dw,Cxzb_dwxb from Cxzb where Cxzb_dw=
case
when @jibie= '3 ' then @danwei
when @jibie= '2 ' then @xuesh
else @www
end