Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

SQL Query CASE statement using two fields

$
0
0

Hi,

I have two fields. One is called rescategory1, the other is called rescategory2.

I'm not sure if its a CASE statement I need or some sort of WHERE clause but I want to create a query that does the following or something similar:

CASE rescategory2
WHEN rescategory1 = '44' AND rescategory2 = '1' THEN 'Backup'
WHEN rescategory1 = '44' AND rescategory2 = '2' THEN 'Hardware'
END AS [Resolution Sub Category]

Basically, I'm looking to give rescategory2 a value based on that of rescategory1 and rescategory2 combined.

How do I write this?

Cheers

Paul


Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>