Reputation: 119
Is it possible to concatenate the result of a case statement into another field of the table? For example this is my table, This is just a random example.
first second third
---- ------ -----
one two three
uno dos tres
This is my part of my sql query
CASE 'some_expression'
WHEN 1 THEN 'Monday'
WHEN 2 THEN 'Tuesday'
ELSE 'undefined
END AS days_of_week'
What I want is to concatenate lets say the result of the statement to one of the fields of my table. For example concatenating the result of the case statement with the 'first' column. So the result could be
days_of_week
------------
Mondayone
Mondayuno
Is this possible to do?
Upvotes: 0
Views: 62
Reputation: 18598
CASE 'some_expression'
WHEN 1 THEN concat('Monday',first)
WHEN 2 THEN concat('Tuesday',second)
ELSE 'undefined'
END AS 'days_of_week'
Upvotes: 1