Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need a Query

Author  Topic 

JonathanChacon
Starting Member

1 Post

Posted - 2009-09-30 : 20:15:11
I have a table in a database with a survey that I had to enter all the answers to 400+ of them. At the end of each survey i added a box to check if they were negative or not. How can I do a query to show results from one column, but only if the negative column is checked, and vice versa. I do understand SQL so I think it's a where statement. However, I already have a WHERE field IS NOT NULL, so how would I add another WHERE statement?

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-09-30 : 20:51:42
just put another condition in it.
WHERE field IS NOT NULL and negative = 1 (or whatever you used to identify it as negative)

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-01 : 01:15:54
or do you mean this?

select other columns...,case when negative=1 then reqdcol else null end from.... 
Go to Top of Page
   

- Advertisement -