应该怎么写才查到两张A,B,给A,B都有一个查询条件,查询结果要分开两张表显示。

解决方案 »

  1.   


    --A和B表各做一次查询
    select * from A where ...
    select * from B where ...
      

  2.   

    比较数据???如果是比较数据,两张表应该可以用join吧!~
      

  3.   


    查询结果要分开两张表显示。

    不是分2个表显示吗?!
    要一次查询显示出来表结构相同直接select * from A where ...
    union all
    select * from B where ...有关联条件的查询就select * from A,B where A.关联字段=B.关联字段 and A.条件=... and B.条件=...