两张表A,B
A和B的CODE字段是对应的,想求出
A.CODE=B.CODE
A.ID=某个值
B.TYPE=某个值
A.TYPE=某个值
的结果 应该怎么写?
select * from A a,B b
where a.id = (#)
and  a.code=b.code
and a.type = (#)
and b.type = (#)

解决方案 »

  1.   


    select * from A a inner join B b 
    on  a.code=b.code 
    where a.id = (#) and a.type = (#) and b.type = (#)
      

  2.   

    select * 
    from A join b on  a.code=b.code 
    where a.id = (#) 
    and a.type = (#) 
    and b.type = (#)
    ..改下顺序
      

  3.   

    select * from A a inner join B b 
    on  a.code=b.code 
    where a.id = '(#)' and a.type = '(#)' and b.type = '(#)'
      

  4.   

    --我猜下 select * 
    from A join b on  a.code=b.code 
    where a.id = (#) 
    and (a.type = (#) 
    or b.type = (#))
      

  5.   

    select * from A a,B b 
    where a.code=b.code 
    and  a.id = (#) 
    and a.type = (#) 
    and b.type = (#)?
      

  6.   


    -- 我再猜
    select * from A a inner join B b 
    on  a.code=b.code 
    where a.id = '#' and a.type = '#' and b.type = '#'