1,'a','b'     第一列是自增列,平均分配即可.即:3行记录做一个标记.一栏
2,'c','d'
3,'e','f'
4,'g','h'
5,'e','f'
6,'g','h'
7,'i','j'
8,'k','l'
1,1,'a','b'
1,2,'c','d'
1,3,'e','f'
2,4,'g','h'
2,5,'e','f'
2,6,'g','h'
3,7,'i','j'
3,8,'k','l'也就是数据平均分配. 不够平均分配的.有多少分配多少.解决后.接贴.

解决方案 »

  1.   

    declare @tab table(id int,a char(1),b char(1))insert @tab values(1,'a','b')
    insert @tab values(2,'c','d')
    insert @tab values(3,'e','f')
    insert @tab values(4,'g','h')
    insert @tab values(5,'e','f')
    insert @tab values(6,'g','h')
    insert @tab values(7,'i','j')
    insert @tab values(8,'k','l')select * from @tabselect [id1]=convert(int,(id-1)/3)+1,* from @tab
      

  2.   

    id          a    b
    ----------- ---- ----
    1           a    b
    2           c    d
    3           e    f
    4           g    h
    5           e    f
    6           g    h
    7           i    j
    8           k    l(8 row(s) affected)id1         id          a    b
    ----------- ----------- ---- ----
    1           1           a    b
    1           2           c    d
    1           3           e    f
    2           4           g    h
    2           5           e    f
    2           6           g    h
    3           7           i    j
    3           8           k    l(8 row(s) affected)
      

  3.   

    :)
    http://community.csdn.net/Expert/topic/5111/5111705.xml?temp=.6556055