日期:2014-05-17 浏览次数:20556 次
CREATE TABLE [dbo].[t1](
','[Code] [nvarchar](30) NULL,
','[Stype] [nvarchar](20) NULL,
','[Dtype] [nvarchar](20) NOT NULL,
','[DValue] [nvarchar](40) NULL
) ON [PRIMARY]
/*
CODE:款号
Stype:样品类型
Dtype:样品进度
DValue:时间值
Stype的值
100 初样
200 尺寸样
300 产前样
400 销售样
500 船样
Dtype的值
10 资料接收时间
20 交付版房时间
30 领料时间
40 预计交样时间
50 实际完成时间
*/
INSERT INTO T1
SELECT '12303','100','10','4-19' UNION ALL
SELECT '12303','100','20','4-19' UNION ALL
SELECT '12303','100','40','4-26' UNION ALL
SELECT '12303','200','10','4-19' UNION ALL
SELECT '12303','200','20','4-19' UNION ALL
SELECT '12303','200','40','4-26' UNION ALL
SELECT '12303','200','10','5-2' UNION ALL
SELECT '12303','200','30','5-11' UNION ALL
SELECT '12303','200','50','5-13' UNION ALL
SELECT '12303','300','10','5-6' UNION ALL
SELECT '12303','300','20','5-12' UNION ALL
SELECT '12303','300','50','5-14' UNION ALL
SELECT '12303','400','10','5-8' UNION ALL
SELECT '12303','400','30','5-15' UNION ALL
SELECT '12303','400','50','5-17' UNION ALL
SELECT '12303','500','10','5-15'
--我想要的结果是
CREATE TABLE [dbo].[t1](
[Code] [nvarchar](30) NULL,
[Stype] [nvarchar](20) NULL,
[Dtype] [nvarchar](20) NOT NULL,
[DValue] [nvarchar](40) NULL
)
INSERT INTO T1
SELECT '12303','100','10','4-19' UNION ALL
SELECT '12303','100','20','4-19' UNION ALL
SELECT '12303','100','40','4-26' UNION ALL
SELECT '12303','200','10','4-19' UNION ALL
SELECT '12303','200','20','4-19' UNION ALL
SELECT '12303','200','40','4-26' UNION ALL
SELECT '12303','200','10','5-2' UNION ALL
SELECT '12303','200','30','5-11' UNION ALL
SELECT '12303','200','50','5-13' UNION ALL
SELECT '12303','300','10','5-6' UNION ALL
SELECT '12303','300','20','5-12' UNION ALL
SELE