SQL ID问题
select distinct 1,'900',a.dsp,5,stuff (a.dsl,1,1,''),1  from jpftab b,jdstab a  
where a.dd#=90000888 order by '900',5;
想让ID4从1,2,3这样按顺序下去
id1     id2	  id3	       id4	id5    id6
1	900	10010003	5	5.000	1
1	900	10010004	5	5.000	1
1	900	10010005	5	5.000	1
1	900	10010007	5	5.000	1
1	900	10010009	5	5.000	1
想要的结果
id1	id2	  id3	       id4	id5    id6
1	900	10010003	1	5.000	1
1	900	10010004	2	5.000	1
1	900	10010005	3	5.000	1
1	900	10010007	4	5.000	1
1	900	10010009	5	5.000	1
------解决方案--------------------
SQL code
--使用identity函数
select distinct 1 as id1,'900' as id2,a.dsp as id3,id4 = IDENTITY(int, 1, 1),stuff (a.dsl,1,1,'') as id5,1  as id6
into #tb from jpftab b,jdstab a  
where a.dd#=90000888 order by id2,id4
select id1,id2,id3,id4,id5,id6 from #tb