I would like to SELECT WHERE column
IS NULL
or =value
depending on result of subquery.
Here is an example incorrect solution that demonstrates the problem:
SELECT *
FROM table
WHERE column=(
SELECT (CASE WHEN COUNT(*) = COUNT(COLUMN) THEN MIN(column) END)
FROM table
)
When the subquery returns NULL
the other query will return nothing because column=NULL
is never true. How do I fix this?
(Subquery source: https://stackoverflow.com/a/51341498/7810882)