Skip to Content
0

SQL <> function help

Feb 13 at 09:43 PM

20

avatar image

I'm trying to get <> function work, and it seems like I'm doing something wrong. I'm trying to not include values 411000 and 411005 by including them in a bracket with <> function. I'm told that the requirement is to use "OR" here. When I run the below code, the result includes both values. What am I doing wrong?

select u.IncidentNumber, u.PrimaryRoleOfUnit
from INC_UnitInformation u
where (u.PrimaryRoleOfUnit  <> 411000 or u.PrimaryRoleOfUnit <> 411005)
SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Christopher Luttrell Feb 13 at 11:14 PM
1
select u.IncidentNumber, u.PrimaryRoleOfUnit
from INC_UnitInformation u
where (u.PrimaryRoleOfUnit  <> 411000 and u.PrimaryRoleOfUnit <> 411005)

I believe the OR is your problem, when it is either of these 2 values the other side of the OR is TRUE so the value gets returned. Try the AND like I posted above.

Share
10 |10000 characters needed characters left characters exceeded