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
 not null query failing when include other clauses

Author  Topic 

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-02-07 : 20:17:59
Hey guys
here is my query:

SELECT
I.ItemCode,
I.ItemName,
i.ItmsGrpCod,
i.SellItem,
I.QryGroup21,
I.QryGroup14
FROM
SBO_T2LIVE.dbo.OITM AS I

WHERE
I.ItemName IS NOT NULL
AND
I.SellItem = 'y'
AND
I.ItmsGrpCod <> 100
AND
I.ItmsGrpCod <> 110
AND
I.ItmsGrpCod <> 105
AND
I.QryGroup14 = 'y'
OR
I.QryGroup21 = 'y'


This however still brings up null values in the itemname column.

when i go..

SELECT
I.ItemCode,
I.ItemName,
i.ItmsGrpCod,
i.SellItem,
I.QryGroup21,
I.QryGroup14
FROM
SBO_T2LIVE.dbo.OITM AS I

WHERE
I.ItemName IS NOT NULL

it will not bring up null values but i can't filter out my other items.

singularity
Posting Yak Master

153 Posts

Posted - 2012-02-07 : 20:26:30
[code]
SELECT
I.ItemCode,
I.ItemName,
i.ItmsGrpCod,
i.SellItem,
I.QryGroup21,
I.QryGroup14
FROM
SBO_T2LIVE.dbo.OITM AS I

WHERE
I.ItemName IS NOT NULL
AND
I.SellItem = 'y'
AND
I.ItmsGrpCod <> 100
AND
I.ItmsGrpCod <> 110
AND
I.ItmsGrpCod <> 105
AND
(I.QryGroup14 = 'y'
OR
I.QryGroup21 = 'y')
[/code]
Go to Top of Page

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-02-07 : 20:35:03
cheers mate,
knew it was something simple!
Go to Top of Page
   

- Advertisement -