I would like to know what can I use to be able to do:
If condition1 true then only display condition 1 value else go to condition 2 and display only condition 2 value.
I have tried to use case when but this seems to be executing both WHEN statements(and this is because both cases exist in the table but i want only the first when to return if both are true). Is there a way to do this?
SELECT
RI.*,
CASE
WHEN
("applianceId"
in
('AlwaysOn','Heating','Cooling','Pool Pump','Hot Water')
and "type" in ('peer'))
THEN 'Measured'
ELSE
("applianceId"
NOT in
('AlwaysOn','Heating','Cooling','Pool Pump','Hot Water')
and "type" IN('peer'))
THEN 'RELEVANCE'
ELSE 'ERROR'
END AS "Select" FROM "SP_CUSTOMER"."RU_INSIGHT" RI
where RI."userId" in
('2270BAF2D64948A7031F620645577C82B7529BB26DA46453B4595F0BE61460D6')
and "type" in ('peer')