有两张表Table1(id1 int,id2 int,name char(10));table(id1 int,id2 int)
我想执行以下操作:
select * from Table1 where (id1,id2) in (select id1,id2 from Table2)
这样的操作有错,为什么会错啊?谢谢

解决方案 »

  1.   

    哥们你还没有说你想实现什么查询咧
    本身你这个语法就是错误的啊!要么你这么写。。
    select * from table1 where id1 in (select photo_id from table2 ) or name in (select merchant_name from table2)
      

  2.   

    语法问题
    select t1.* from Table1 t1 
      join Table2 t2
    on t1.id1=t2.id1  and t1.id2=t2.id2 
      

  3.   


    select * from Table1 where (select id1,id2 from Table1) in (select id1,id2 from Table2)