交叉表问题,请赐教!
create table tabpo(weekno nvarchar(10) not null,ponumber nvarchar(15) not null)
insert tabpo select 'we0403','PO001'
union all select 'we0403','PO002'
union all select 'we0403','PO003'
union all select 'we0403','PO004'
union all select 'we0403','PO005'
union all select 'we0410','PO006'
union all select 'we0410','PO007'
union all select 'we0410','PO008'
union all select 'we0417','PO009'
union all select 'we0417','PO010'
union all select 'we0424','PO011'
union all select 'we0424','PO012'
union all select 'we0424','PO013'
union all select 'we0424','PO014'
结果如下:
we0403 we0410 we0417 we0424 ...
PO001 PO006 PO009 PO011
PO002 PO007 PO010 PO012
PO003 PO008 PO013
PO004 PO014
PO005