Thursday, July 3, 2008

Let's Talk about .. SQL Server 2005-Case..When

Today P'Tao told me how to use case and when in SQL. This is the example.
[SQL]
SELECT Product_ID
, Sample =
CASE Word
WHEN 'A' THEN 'Apple'
WHEN 'B' THEN 'Banana'
WHEN 'C' THEN 'Coconut'
ELSE 'Panda' END
, Description
FROM Production.Product

No comments: