I want to return 1 if some number already exists in the table and 0 otherwise.
I tried something, but it does not work:
select case when 100 in (select distinct id from test) then '1' else '0' from test
I want something similar to an existence function that already exists in PostgreSQL, but instead of true and false I want 1 or 0 .
source share