select distinct fb_mamodel from tblb_machine where fb_macode in(select distinct fb_macode from tblb_matoba where fbatterycode='$fbatterycode') and fclasscode='1' and fb_mabrand='$fb_babrand'"distinct : 使记录不重复查询 fb_macode 等于子查询 (select distinct fb_macode from tblb_matoba where fbatterycode='$fbatterycode')
 并且满足 fclasscode='1' and fb_mabrand='$fb_babrand'

解决方案 »

  1.   

    查询唯一的fb_mamodel,该值满足条件
    1)值的范围在是在tblb_matoba表里并且 fbatterycode='$fbatterycode'(子查询)
    2) fclasscode='1' and fb_mabrand='$fb_babrand'"
      

  2.   

    谢谢"select distinct * from tblad_machine where fmabrand='$mabrand' and fmacode in (select distinct fmacode from tblmatoad where fadcode in (select distinct fadcode from tblnewadapters where ftype='AC'))  order by fmabrand"这个列复杂