在MS SQL SERVER 中我是这样的,嵌套查询:
表tab1中有tab1_id,tab1_name,tab2_id,表tab2中有tab2_id,tab2_name
select * from tab1 where tab2_id in (select tab2_id from tab2)请问这条sql语句怎么转成mysql的?

解决方案 »

  1.   

    select * from tab1 where tab2_id in (select tab2_id from tab2)select distinct a.* from tab1 a,tab2 b where a.tab2_id = b.tab2_id 估计这两个都行.
      

  2.   

    select * from columninfo where columnid in (select columnid from users_authority)发生这个错误:Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
      

  3.   

    你这个是跟排序规则有关..一个是gbk_chinese_ci一个是latin1_swedish_ci..
      

  4.   

    主要不知道mysql支不支持嵌套查询/....
      

  5.   

    如果没有排序问题,对于这个语句,mysql与sql的写法一致。