成员查找 in ()

70 阅读1分钟

格式

select * from 表名 where 列名 in (数据1,数据n)

等价于

select * from 表名 where 列名 = 数据1 or 列名 = 数据n

例子

查出三国表中,国家为吴国或者其他国的所有数据

select * from sanguo where country in('吴国','其他')
select * from sanguo where country = '吴国' or country ='其他'