-> If we want to retrun boolean value from the query or more than one result based on the condition then we can use case in postgresql. We can use this in insert or update and in join queries also.
Syntax:
select column_name
case when column_name ilike ‘%hi%’ then true
else false
end
from table_name where condition;
Eg:
select case when code is true then
(select code_conc_value from codeconcrete where code_concrete_id =spec_definition_id)
else
attribute_value
end
from specdefinitionconcrete where spec_id =’30051′;