|
-
Dec 19th, 2008, 01:11 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] SQL Case Performance Q
If I would like to check multiple fields in my record would it be wise to use a case or is there a better method? Basically I want to check if multiple fields have a 1, if they do I am going to display 'yes' in one field.
So it would kinda look like this
Select ID, Sub_ID, Name,
CASE
WHEN Check1 = 1 THEN 'Yes'
WHEN Check2 = 1 THEN 'Yes'
WHEN Check3 = 2 THEN 'Yes'
--etc...
ELSE 'No'
END As HasACheck
FROM Table1
Is there a better way that I should be doing this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|