I have table named boolean
which contain 'true' and/or 'false' values as strings in one column.
I have problem to create case
statement to show me whether there are only 'true' or 'false' or 'both' values
Example 1:
'true'
'true'
result:'true'
Example 2:
'false'
'false'
'false'
Result: 'false'
Example 3:
'true'
'false'
'true'
Result: 'both'
Edit:
case
statement should look like:
case
when "column content are only true values" then 'true'
when "column content are only false values" then 'false'
else 'both'
end
You could aggregate the
max
andmin
of the column, and then evaluate the results - if they are the same, there's only one value in the column. If not, there must be both. Note that since these are string representations the values are sorted lexicographically: