How to use SQL CASE in Advanced Database Layout
Case logic can be in the Select or as part of Order By etc. We support all, for example suppose we have this Select statement
SELECT customer.customerid, Category =
CASE customername
WHEN 'Costco' THEN 'Wholesale'
WHEN 'Target' THEN 'Retail'
WHEN 'Walmart' THEN 'Wholesale'
ELSE 'Not applicable'
END,
customername
FROM dbo.[customer]
For example, you can take the above query and go to the Advanced Database Layout, and in the Query box, you can put this same SQL in the query box and save. Similar to how we put the Left Join query.
0
Please sign in to leave a comment.
Comments
0 comments