declare @timm varchar(2)
select @timm=cast(datepart(hh,getdate()) as varchar(2))select * from
(
select c.pihao,c.sxrq,c.shl as kcsl,a.jwh,
case xshy when @timm in ('08','09','10','11','12','13') then select xshy from xshydoc where xshyid like '%A%' else select xshy from xshydoc where xshyid like '%P%' end
from hwsp a,sphwph c
where a.spid=c.spid and a.spbh like '1101615')b
order by b.kcsl desc
select @timm=cast(datepart(hh,getdate()) as varchar(2))select * from
(
select c.pihao,c.sxrq,c.shl as kcsl,a.jwh,
case xshy when @timm in ('08','09','10','11','12','13') then select xshy from xshydoc where xshyid like '%A%' else select xshy from xshydoc where xshyid like '%P%' end
from hwsp a,sphwph c
where a.spid=c.spid and a.spbh like '1101615')b
order by b.kcsl desc
A001 张三
A002 李四
P001 王五
P002 赵六
上午选择A下午选择B
就是这样.怎么用SQL_T办到?
不能用在CASE里取的第一条记录第一个字段啊