27,580
社区成员
发帖
与我相关
我的任务
分享
with t as (
select '柏林科技灰OZWT16-25B 6000' as itemkey,0.988 as itemSndUOMRate,'A62-1' as LocationName,19 as SndPureQtyBal,'支' as SndUOM
union all
select 'aa',0.773,'通道',1,'支'
union all
select 'aa',0.773,'过道',1,'支'
union all
select 'bb',0.188,'放飞',1,'次'
union all
select 'bb',0.188,'双飞',12,'次'
union all
select 'bb',0.188,'三劈',6,'次'
)
,t1 as (
select itemkey,itemsnduomrate,locationname+'/'+convert(varchar,sndpureqtybal)+'/'+snduom as PtionStk from t
)
select * from (select distinct itemkey,itemsnduomrate from t1) a
cross apply (
select stuff((select '||'+ptionstk from t1 where itemkey=a.itemkey and itemsnduomrate=a.itemsnduomrate for xml path('')),1,2,'') as ptionstk
) b