假定你所说的Table1表的字段名分别为F1、F2、F3(F3应该是bit类型的吧),用如下SQL语句试试:select A.F1, A.F2, B.F2 as F4 from (select F1,F2 from TABLE1 where F3=1) as A
left outer join (select F1,F2 from TABLE1 where F3=0) as B on (A.F1=B.F1)

解决方案 »

  1.   

    加distinct试试:select distinct A.F1, A.F2, B.F2 as F4 from 
    (select F1,F2 from TABLE1 where F3=1) as A
    left outer join (select F1,F2 from TABLE1 where F3=0) as B on (A.F1=B.F1)
      

  2.   

    用MSN沟通吧,这个太慢。我的MSN是:[email protected]
      

  3.   

    再试一下吧:select distinct A.F1, A.F2, B.F2 as F4 from 
    (select distinct rtrim(F1) as F1,F2 from TABLE1 where F3=1) as A
    left outer join (select distinct rtrim(F1) as F1,F2 from TABLE1 where F3=0) as B on (A.F1=B.F1)
      

  4.   

    安装一个不是很快不介意我给你的发个QQ安装版的邮件吧table1(kah,rq,zt)   工作人员上班时打卡的信息0001354878            2003-02-15  08:20:26.000   1  早晨上班打卡时间
    0001354878            2003-02-15  12:00:26.000   0  中午下班打卡时间
    0001354878            2003-02-15  12:40:26.000   1  下午上班打卡时间
    0001354878            2003-02-15  16:40:26.000   0  下午下班打卡时间