1.select * from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id
2.select kp_code from dzkp where kp_id not in (select a.kp_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
3.select xcd_code from xcd where xcd_id not in (select b.xcd_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
如何能让这三个显示在一个页面,取得的记录按1.2.3来排列出来.

解决方案 »

  1.   

    tryselect a.kp_code from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id
    Union All
    select kp_code from dzkp where kp_id not in (select a.kp_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
    Union All
    select xcd_code from xcd where xcd_id not in (select b.xcd_id from dzkp a,xcd b where a.chengjiren_id=b.chengjiren_id)
      

  2.   

    paoluo(一天到晚游泳的鱼)
    -----------------
    不错
      

  3.   

    1樓這樣的union all是否有問題?
    三個查詢的個數雖然相同,但第三個查詢的字段與上面兩個查詢的字段不同哦。。
      

  4.   

    livan1038(李枫) ( ) 信誉:100  2007-08-09 11:22:50  得分: 0  
     
     
       1樓這樣的union all是否有問題?
    三個查詢的個數雖然相同,但第三個查詢的字段與上面兩個查詢的字段不同哦。。
      
     
    -------------
    如果字段數目和類型一致,沒有問題。