我想用不同的值选择两列
SELECT id FROM ads WHERE onoff='1' AND again='0'
SELECT id FROM ads WHERE onoff='2' AND again='1'
SELECT id FROM ads WHERE onoff='3' AND again='1'
有没有一种方法可以在一个sql中完成这一切?
最佳答案
SELECT id
FROM ads
WHERE (onoff = '1' AND again = '0')
OR (onoff = '2' AND again = '1')
OR (onoff = '3' AND again = '1')
关于php - PHP/SQL:使用不同的值选择2列3次,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22156009/