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
 Filtering out certain zip codes

Author  Topic 

meef
Posting Yak Master

113 Posts

Posted - 2012-06-04 : 15:08:48
I'm trying to filter out a location for a report I'm running, but it's not filtering. This is my WHERE statement:

	AND (ShDt >= @ShippedLo
AND ShDt <= @ShippedHi)
and (dzp <> '44256'
or ozp <> '44256')
and lc_scac <> ' '


I put parenthesis around the zips because I thought it had to do with the precedence but don't know what else to try.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-04 : 15:11:07
Use AND instead of OR.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

meef
Posting Yak Master

113 Posts

Posted - 2012-06-04 : 15:43:56
Ah, got things mixed up in my head. I also need to have one that ONLY shows that zip in one of those two fields so I was thinking this was the report I was making.

Basically, all is well now. Thanks.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-06-04 : 15:45:26
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -