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
 Selecting with multiple criteria

Author  Topic 

Bjcascone
Starting Member

37 Posts

Posted - 2009-01-28 : 14:22:50
I have a very basic select query i can not remember how to write. I want to select All of the records in which 5 of the columns are '0'.

Something like:

Select *
From [DB].[dbo].[TableName]
Where ColA, ColB, ColC,ColD = '0'
Group By ColA, ColB, ColC,ColD

I know something is off i just can not remember how the syntax goes..

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-28 : 14:38:18
[code]Where col1=0 and col2=0 and col3=0 and col4=0 and col5=0[/code]
Go to Top of Page

sital
Yak Posting Veteran

89 Posts

Posted - 2009-01-29 : 00:12:47
The query can be:

select *
from [DB].[dbo].[TableName]
where colA=0 and colB=0 and colC=0 and colD =0.

You can replace and with or depending your requirement.
Go to Top of Page
   

- Advertisement -