本篇内容主要讲解“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可以支持多个字段吗”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!