I have a WHERE statement in my report that lists what I need pulled from a table,
WHERE PrimaryAction= '308' AND PrimaryAction= '309' AND PrimaryAction= '307 AND SecondaryAction= '308'
One, it isn’t pulling just those instances. I can’t figure out what is wrong. Or is there a way to combine/condense this?
Two, can I do it and have it say something like,
PrimaryAction= ‘308’ ‘309’ ‘307 , THEN ‘Yes’ so that in my report it just prints out yes if that is the case?
I tried combining them, there is Primary, Secondary , and Tertiary for the same codes but it just didn’t pull anything when I ran it. It wouldn’t even run when I tried to change to say Yes.
the condition can’t be 308,307 and 309 at the same time
So you can do.
but be reminded
The SQL Server AND operator takes precedence over the SQL Server OR operator (just like a multiplication operation takes precedence over an addition operation).
see SQL Logic Operator Precedence: And and Or for more example and explanation
WHERE (PrimaryAction= '308' 'OR PrimaryAction= '309' OR PrimaryAction= '307') AND SecondaryAction= '308'