select a.id,a.f1 from master a left join item b on a.id = b.id
where b.qty>=101 and b.qty<=102

解决方案 »

  1.   

    错了。
    select distinct a.id,a.f1 from master a,item b where a.id=b.id and b.qty>=101 and
     b.qty<=102或
    select * from master where id in
      (select id from item where qty >=101 and qty <=102)
      

  2.   

    select distinct a.id,a.f1 from master a,item b where a.id=b.id and b.qty>=101 and b.qty<=102
      

  3.   

    select * 
    from master 
    where id in
      (select id 
       from item 
       where qty >=101 and qty <=102)
      

  4.   

    为什么不使用自然连接呢?在你的表设计中不是有:字段id与从表Item的字段id关联,只要再加上:master.id=item.id1就行了。
    使用distinct是不合适的,原理不一样,只是结果在一定情况下是相同而已。
      

  5.   

    最好是建立一个视图。利用sql自己带的视图工具相当方便