This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Efficient SQL statement

Good Day,

I am looking for some advice with the below statement, we have a node that based on UNDP Polling methods have different conditions the question is, is the below an efficient SQL statement to use? or is the WHERE clause overkill? maybe use a CASE statement? i am still building my knowledge on this any information would be very helpful emoticons_happy.png

FROM 

(CustomPollerStatus INNER JOIN CustomPollerAssignmentView ON (CustomPollerStatus.CustomPollerAssignmentID = CustomPollerAssignmentView.CustomPollerAssignmentID))  

LEFT OUTER JOIN CustomPollers ON (CustomPollerAssignmentView.CustomPollerID = CustomPollers.CustomPollerID) 

LEFT OUTER JOIN Nodes ON (CustomPollerAssignmentView.NodeID = Nodes.NodeID) 

where AssignmentName = 'a' and currentvalue != '24'

and AssignmentName = 'b' and currentvalue != '1'

and AssignmentName = 'c' and currentvalue != 'RUN'

and AssignmentName = 'd' and currentvalue != 'RUN'

and AssignmentName = 'e' and currentvalue != '72'

and AssignmentName = 'f' and currentvalue != '30'

and AssignmentName = 'g' and currentvalue != '72'

and AssignmentName = 'h' and currentvalue != '30'

and AssignmentName = 'i' and currentvalue != '276'

and AssignmentName = 'j' and currentvalue != '72'

Thank you @michael_higgins on your guide Advanced Custom SQL Alert with UnDP