select A.col2,B.col2
from tablename A,tablename B where A.col1<b.col1

解决方案 »

  1.   

    select
        a.col2,b.col2
    from
        表 a,表 b
    where
        a.col1<b.col1
      

  2.   

    declare @tb table(col1 int,col2 char(1))
    insert into @tb
    select 1,'d'union all
    select 2,'p'union all
    select 3,'t'union all
    select 4,'k'
    select a.col2,b.col2 from @tb a,@tb b where a.col1<b.col1 order by a.col2/*
    col2 col2 
    ---- ---- 
    d    p
    d    t
    d    k
    p    t
    p    k
    t    k(所影响的行数为 6 行)
    */