I'm trying to get a conditional WHERE statement but I'm not sure how to do this without using CASE WHEN.
SELECT * FROM
`...`
WHERE (CASE WHEN product <> 'core news' THEN type <> 'video')
ORDER BY product, metric, type
CodePudding user response:
Maybe you mean this
SELECT *
FROM yourtable
WHERE
(
(product <> 'core news' AND type <> 'video')
OR (product = 'core news')
)
ORDER BY product, metric, type
CodePudding user response:
If I understand you question correctly I believe you want
SELECT * FROM
`...`
WHERE product = 'core news' OR (product <> 'core news' AND type <> 'video')
ORDER BY product, metric, type