Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SQL <> function help

former_member548403
Participant
0 Likes
594
  • SAP Managed Tags

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)
1 REPLY 1
Read only

former_member532835
Discoverer
528
  • SAP Managed Tags
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.