我是MySQL的新手并且想知道;而不是做
SELECT fields FROM table WHERE name="tim" OR name="bob" OR name="nancy" OR name="john"
如果我可以做类似
的事情SELECT fields FROM table WHERE (name="tim" OR "bob" OR "nancy" OR "john")
答案 0 :(得分:9)
使用IN
子句:
SELECT fields FROM table WHERE name IN ("tim", "bob", "nancy", "john");
答案 1 :(得分:4)
你可以这样做 -
SELECT fields FROM table WHERE name in("tim","bob","nancy","john")