帮我解析下这段SQL语句好吗?

mfzhao 2005-11-23 11:45:29
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'"
...全文
107 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mfzhao 2005-11-24
  • 打赏
  • 举报
回复
谢谢

"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"

这个列复杂
zysoft17 2005-11-23
  • 打赏
  • 举报
回复
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'


zalvsa 2005-11-23
  • 打赏
  • 举报
回复
查询唯一的fb_mamodel,该值满足条件
1)值的范围在是在tblb_matoba表里并且 fbatterycode='$fbatterycode'(子查询)
2) fclasscode='1' and fb_mabrand='$fb_babrand'"

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧