请问
在数据库中有这么一个表
有一列是
a
a
b
b
c
c
如何用sql语句让它按以下现实
a
b
c
a
b
c

解决方案 »

  1.   

    declare @t table(a varchar(10))
    insert into @t
    select 'a'
    union all select 'a'
    union all select 'b'
    union all select 'b'
    union all select 'c'
    union all select 'c'select distinct a from @t
    union all
    select distinct a from @t
    /*
    (所影响的行数为 6 行)a          
    ---------- 
    a
    b
    c
    a
    b
    c
    */
      

  2.   

    gahade(与君共勉)老大,這樣不行吧
    一共才5條記錄,排序後6條
      

  3.   


    create table t(c varchar(10))
    insert t
    select 'a'
    union all select 'a'
    union all select 'b'
    union all select 'b'
    union all select 'c'
    union all select 'c'
    select c1=identity(int,1,1),* into #lsb from tselect *,c1%2
    from #lsb
    order by c1%2 desc,c1 asc
    drop table t,#lsb
      

  4.   

    如果加上一个id列表示序号是否可以简单话sql语句