mysql 数据库查询遇到的坑 多条件 or 查询

select* from where m.is_delete = 0 and alow.user_type =3 and alow.is_delete = 0
        
     
           
                and (alow.user_uuid = "08b08c9c-11e3-11ea-965f-00163e0a9cf7"
                or alow.user_uuid in (select u.user_uuid FROM ccs_user u
                LEFT JOIN ccs_dept d on d.dept_uuid = u.dept_uuid
                where d.parent_uuid = "197121900" or d.dept_uuid = "197128190)

多个and  中包含or 时需要用()把and(and ....or) 否则会造成查询结构重复 
          

发布了198 篇原创文章 · 获赞 23 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/stone_tomcate/article/details/103915420