Mapping column values to return values

Multiple-row VALUES tables are useful in mapping column values to desired return values in queries.

-- get the names of all departments in OhioSELECT DeptName
FROM Depts,
(VALUES (1, 'Shoe'),
    (2, 'Laces'),
    (4, 'Polish'))
AS DeptMap(DeptCode,DeptDesc)
WHERE Depts.DeptCode = DeptMap.DeptCode
AND Depts.DeptLocn LIKE '%Ohio%'

You might also find it useful to store values used often for mapping in a persistent table and then using that table in the query.

Related concepts
Multiple rows
Creating empty queries