hi marcel1,
below select with case clause is standard SQL1999. Maybe it works also on MS SQL Server.
SELECT x,
(
CASE
WHEN x = 'AB' AND y LIKE 'CD%' THEN 'CD'
WHEN 'ZZ' AND y LIKE 'CC%' THEN 'BA'
WHEN x IN ('bbb','sss','ddg') THEN 'BB'
ELSE 'unknown thing'
END
) AS xx
FROM yourtable WHERE ... ;
This will produce a list WITH two COLUMNS, FOR example
x xx
------------
AB CD
sss BB
wow unknown thing
You can also omit the first attribute x from the select, if you don't need original x values.
Like x, y must also be attribute of yourTable.
Maybe this will help you.
krs,
tesu