27,579
社区成员
发帖
与我相关
我的任务
分享
-- 使用 union all
select custID , custName , opeID , 'Monday'
from mytable where Monday = 'true'
union all
select custID , custName , opeID , 'TuesDay'
from mytable where TuesDay = 'true
'
[/quote]
大神,太棒了,就是我想要的结果,又学到了,分分送上~
-- 使用 union all
select custID , custName , opeID , 'Monday'
from mytable where Monday = 'true'
union all
select custID , custName , opeID , 'TuesDay'
from mytable where TuesDay = 'true
'
select custID , custName , opeID ,
case when Monday = 'true' then ',Monday ' end + case when TuesDay = 'true' then ',TuesDay ' end
-- 这样?
from mytable
select custID , custName , opeID ,
case when Monday = 'true' then 1 end + case when TuesDay = 'true' then 1 end
-- 都写全了
from mytable