table name: game
id player keeper
1 a b
2 c d
3 a e
4 c b
condition_one:其中player = a和keeper = b condition_two:其中player = b和keeper = a
我想实现:condition_one或condition_two 有没有人有解决方案?
答案 0 :(得分:1)
需要使用or
声明:
select *
from game
where ((player = 'a' and keeper = 'b') or (player = 'b' and keeper = 'a'))
答案 1 :(得分:0)
在MySQL中,您可以使用元组:
select g.*
from game g
where (player, keeper) in ( ('a', 'b'), ('b', 'a'));