Let us start with basic programming and then get into SQL. CASE is an
expression. An expression has one and only one data type and returns
one and only one scalar value.
Now for the SQL:
1) SELECT always has a FROM; SELECT by itself is dialect
2) Please be consistent with capitalization so people can read your
code
3) RDBMS has no magical, universal "id" because it follows the logical
Law of Identity -- to be is to be something in particular; to be
nothing in particular or everything in general is to be nothing at
all.
4) Do not use the old proprietary "<column name> = <expression>"
syntax. Please learn that it does not create rows, as you tried to
do.
Here is a stinky kludge:
SELECT CASE
WHEN @who IN ('me', 'them')
THEN col1
WHEN @who = 'him'
THEN col4
ELSE '' END AS magic_something_1,
CASE @who
WHEN 'me' THEN col2
WHEN 'them' THEN col3
WHEN 'him' THEN col5
THEN ELSE '' END AS magic_something_2,
CASE @who
WHEN 'me' THEN col3
WHEN 'them' THEN col5
WHEN 'him' THEN co6
THEN ELSE '' END AS magic_something_3
FROM Foobar
WHERE vague_magic_id = @in_vague_magic_id
Remember that freshman course on Software Engineering? The
fundamentals of this craft? Flag coupling -- the worst way to write
code in any language? "Britney Spears, Squids and Automobiles" is a
phrase that refers to a piece of crappy code that has no cohesion --
you have no idea what it does until run time.