select * from pers where code=1
unoin
select * from perss where code=1

解决方案 »

  1.   

    select * from pers where code = 1
    union all
    select * from perss where code = 1
      

  2.   

    呵呵,楼主是想得到JOIN的结果,楼主把你想得到的结果数据列出来看看呀,星星们怎么都用union了,好象这两种结果是完全不一样的吧.
      

  3.   

    nmaes    addr     age     code 
    李鹏小 四川 34 1
    周小庆 东海 34 1
    瘟神人 广东 23 1
    吴达在 中国 44 1
    李知在 广东 34 1
    刘和在 日本 33 1
    王成兵 绵阳 25 1这是想得到的结果!
    而用这条语句:select * from pers as a join perss as b on(a.code=b.code) where a.code='1' or b.code='1'
    就得到了4*3=12条结果了(JOIN的交叉结果)
    我现在想得到的结果是7条记录!
      

  4.   

    按你上面的要求
    那就是union all了.