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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Probl using and / or

Author  Topic 

jun0
Starting Member

32 Posts

Posted - 2013-03-13 : 09:51:37
Hi Im doing a selet on a table, and the where clause looks like this:

where pmobject = 'object 1' and
'column 1' is not null or
'column 2' is not null or
'column 3' is not null or
'column 4' is not null


However this returns incorrect results because in the pmobject field I still get pmobjects other than 'object 1' in the results

There is something easy I'm missing, wondered if you guys could point me at it?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-13 : 10:17:28
[code]
....
where pmobject = 'object 1' and
('column 1' is not null or
'column 2' is not null or
'column 3' is not null or
'column 4' is not null)
[/code]


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -