Skip to content
Advertisement

Not return row from table when use the case when condition

I have a basic question. I want to return data from my table when the condition is true but when it is not I got the null row, but I don’t want that.

This is my example:

 select case when coalesce(var, '') != '' then (select id from user) end

when var is not ” I got data, bat, when is not I, got null

enter image description here

Advertisement

Answer

Filter with a WHERE condition:

select id from "user"
where coalesce(var, '') = '';
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement