select f1 from table1 where f2 in (select f3 from table2);MySQL4.1.0以上才支持子查询,但可以这样:
select f1 from table1 t1 inner join table2 t2 on t1.f2=t2.f3

解决方案 »

  1.   

    子查询可不可以化为复合查询:select f1 from table1、table2 where table1.f2 = table2.f3;=========
    为什么??
      

  2.   

    谁能给我一个这样的例子
    table1 中是个大数集,而table2 是其中的子集,就是说 table2 表中的数据都是从table1中得到的,它们都有一个共同的字段 item_id .但table2 中的item_id的数据可以有重复的,我现在要求把table1中没有在table2中出现过的数据拿出来,
    我在MSSQL 中可以这样写,为什么在mysql中不可以呢?
    select item_id from table1 where item_id not in(select distinct item_id from table2)
      

  3.   

    找到了http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=40441用习惯了msSQL ,来用mySQL 真不习惯,很多命令都不能用!唉!!!