如何编写mysql查询,以便可以选择等于resultA或resultB或resultC等的列下的条目。

就像是:

SELECT * FROM myTable WHERE myColumn = resultA OR WHERE myColumn = resultB OR WHERE myColumn = resultC...

最佳答案

SELECT *
FROM myTable
WHERE myColumn = 'resultA'
   OR myColumn = 'resultB'
   OR myColumn = 'resultC';

或者,
SELECT *
FROM myTable
WHERE myColumn IN ('resultA', 'resultB', 'resultC');

关于mysql - mySQL查询选择列,其中value = a或value = b等,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22543567/

10-11 07:15