DB2 How to use case with multiple conditions?
I have a DB2 Server and I want to select data depending on the condition.
If I have the Value Value in the ColumnX, ColumnY or ColumnZ it should search for it between the TB2.Column1 and TB3.Column1
My statement is a bunch of left outer joins but it looks like that:
SELECT
CASE
WHEN (TB1.ColumnX || TB1.ColumnY || TB1.ColumnZ) = 'Value'
THEN Statement1
ELSE ' '
END AS MyColumn
FROM
TB1 LEFT OUTER JOIN TB2 ON TB1.JOINCOL = TB2.JOINCOL
LEFT OUTER JOIN TB3 ON TB2.JOINCOL2 = TB3.JOINCOL
WHERE TB1.Column1 between TB2.Column1 and TB3.Column1
But it doesn't work, is there a mistake in the syntax?