我正在尝试从2列中选择多个值。我可以使用1列查询,例如:
SELECT *
FROM table
WHERE
town IN ( 'Oxford' , 'Abingdon' )
但是,我想做类似的事情:
SELECT *
FROM table
WHERE
town IN ( 'Oxford' , 'Abingdon' )
AND type IN ( 'type1','type2')
但我无法让它发挥作用。
基本上我想选择所有的地方:
town = Oxford and type = type1
town = Oxford和type = type2
town = Abingdon并输入= type1
town = Abingdon和type = type2
答案 0 :(得分:1)
也许这会奏效:
SELECT * FROM table WHERE (town IN ( 'Oxford' , 'Abingdon' )) AND (type IN ( 'type1','type2'))