select * from (select (...) as a,(...) as b from table) t where a=b 

解决方案 »

  1.   


    --这样就可以:
    select * from (select (...) as a,(...) as b from table) t where a=b
      

  2.   

    declare @t table(Name1 varchar(10),Name2 varchar(10))
    insert @t select 'A','B'
    insert @t select 'C','A'
    insert @t select 'B','E'
    insert @t select 'E','E'
    select name1 as a,name2 as b from @t where name1=name2
      

  3.   

    看你的代码就是单个表自连接:你可以参考下面代码
    select * from timetable a inner join timetable b on a.train_id=b.train_id