Mysql in 多个字段的用法

xiaohai 2020-04-02 19:27:00 4531人围观 标签: Mysql 
简介Mysql in 多个字段的用法

是否对mysql的in还只是停留一个字段的使用呢?

1. 基本用法

select * from users where id in (1,2,3);
2. 多个字段同时使用
select * from users where (id,type) in ((1,2),(2,2),(3,1));
3. 多表同时多个字段使用
select * from users where (id,type) in (select user_id,type from income where number > 10) limit 0,10;