I have a table with metadata and I need to get the value if they are all equal, or if they are not equal then return 'mixed', or if all are null then return null.
id | color | size | shape | area
1 | blue | small | square |
2 | | small | circle |
3 | blue | small | oval |
4 | blue | small | oval |
select distinct color, size, shape, area
from table
where id = 1 or id = 2 or id = 3;
The expected result would be one result with the following-
'mixed', 'small', 'mixed', null