如何将:
jgbm zcbh firstUserId secondUserId thirdUserId
650000 650000101000016 NULL b NULL
650000 650000101000016 a NULL NULL
650000 650000101000016 NULL NULL c用sql 转化为:
650000 650000101000016 a b c请教各位专家?
jgbm zcbh firstUserId secondUserId thirdUserId
650000 650000101000016 NULL b NULL
650000 650000101000016 a NULL NULL
650000 650000101000016 NULL NULL c用sql 转化为:
650000 650000101000016 a b c请教各位专家?
FROM TB GROUP BY jgbm,zcbh
a=max([firstUserId]),
b=max([secondUserId]),
c=max([thirdUserId])
from @T
group by jgbm,zcbh
insert t
select '650000', '650000101000016' , NULL, 'b' , NULL union all
select '650000', '650000101000016' , 'a' ,NULL , NULL union all
select '650000', '650000101000016', NULL , NULL , 'c'
select gbm , zcbh ,max(firstUserId) firstUserId,max(secondUserId) secondUserId,max(thirdUserId ) thirdUserId
from t
group by gbm , zcbh
drop table t
union all
select 棒性,班次,开始,结束, profile = 无记录, profile = 无地标 from 巡更
order by 棒性,班次,开始,结束怎样将上面的结束保存入临时表里?因有两个字段都是“profile”