select * from 
(select opendate from a
unoin
select opendate from b
unoin
select opendate from c
unoin
select opendate from c
unoin
select opendate from e)temp
order by opendate

解决方案 »

  1.   

    select *, identity(int,1,1) as id into #t from a
    insert #t select * from b
    insert #t select * from c
    insert #t select * from d
    insert #t select * from e
    select * from #t as A where id = (select min(id) from #t where OpenDate = A.OpenDate) order by A.OpenDate
      

  2.   

    to Crazyfor:有错服务器: 消息 156,级别 15,状态 1,行 5
    在关键字 'select' 附近有语法错误。
    服务器: 消息 170,级别 15,状态 1,行 11
    第 11 行: ')' 附近有语法错误。
      

  3.   

    select * from 
    (select opendate from a
    unoin
    select opendate from b
    unoin
    select opendate from c
    unoin
    select opendate from d
    unoin
    select opendate from e) temp
    order by opendate
      

  4.   

    SELECT DISTINCT opendata
    FROM a
    UNION
    SELECT DISTINCT opendata
    FROM b
    ............
    ORDER BY opendata
      

  5.   

    to Crazyfor:一样的错误服务器: 消息 156,级别 15,状态 1,行 5
    在关键字 'select' 附近有语法错误。
    服务器: 消息 170,级别 15,状态 1,行 11
    第 11 行: ')' 附近有语法错误。
      

  6.   

    select * from 
    (select opendate from a
    union
    select opendate from b
    union
    select opendate from c
    union
    select opendate from d
    union
    select opendate from e) temporder by opendate--unoin>union
      

  7.   

    对了。请问“temp”起什麽作用??不写“temp”为什麽有错误???谢谢!!
      

  8.   

    不写“temp”为什麽有错误???