mySQL WHERE子句速记

时间:2015-01-19 14:51:45

标签: mysql where-clause shortcut

是否可以简写mySQL where子句并说:

SELECT * FROM table WHERE (animal = cat OR dog OR bird)

而不是说:

SELECT * FROM table WHERE (animal = cat OR row = dog OR row = bird)

由于

1 个答案:

答案 0 :(得分:2)

您正在寻找的是IN运营商。

SELECT * FROM table WHERE animal in ('cat','dog', 'bird')