本篇内容主要讲解“mysql中in可以支持多个字段吗”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“mysql中in可以支持多个字段吗”吧!
基本用法
select * from user where user_id in (600,601,602);
多个字段同时使用
select * from user where (user_id,type) in ((568,6),(569,6),(600,8));
多表同时多个字段使用
select * from user where (legal_id,type) not in ( select a.legal_id,a.type from user as a , role_user_relation as b where a.legal_id=b.legal_id and a.type=b.legal_type ) limit 0,10;
SELECT Department.name AS 'Department', Employee.name AS 'Employee', Salary FROM Employee JOIN Department ON Employee.DepartmentId = Department.Id WHERE (Employee.DepartmentId , Salary) IN ( SELECT DepartmentId, MAX(Salary) FROM Employee GROUP BY DepartmentId )
到此,相信大家对“mysql中in可以支持多个字段吗”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。