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
 where with parameter

Author  Topic 

glda19
Starting Member

3 Posts

Posted - 2015-05-03 : 04:36:58
Hi

i have a column with a number of dogs in it.
now on the basis of a parameter
when the parameter is 0
then i want to find only the numer of dogs =0

if the parameter =1
then i whant to find only the number of dogs >=1

how can i do that whit a where statement

Kristen
Test

22859 Posts

Posted - 2015-05-03 : 08:35:09
[code]WHERE (@MyDogs = 0 AND NumberOfDogs = 0)
OR (@MyDogs = 1 AND NumberOfDogs >= 1)[/code]
Go to Top of Page
   

- Advertisement -