I have a column within a table of data type jsonb and another column of type bool.
I am looking to update the latter to true, else false, when the jsonb contains a value other than 'null' for certain attributes.
This is what I have so far.
update table
set bool_column =
case
when
jsonb_column->'term1' != 'null'
or jsonb_column->'term2' != 'null'
or jsonb_column->'term3' != 'null'
or jsonb_column->'term4' != 'null'
then true
else false;
I was able to figure out how to select the columns in the table but I can't figure out how to update a different column.
Your help would be much appreciated. Thanks.