Systems Management Question
Smart Label for machines in ip range and exclusions
01/29/2018 1011 views
I have a query where I want to add a smart label for all machines in a given ip range, but exclude those that start with TC.
It works successfully on the IP range but it still includes those with names that start with TC
here is an excerpt from my query:
OR (1 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP like '%172.16.12.%' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP like '%172.16.12.%' and MACHINE.NAME not like '%TC%' )) )
Community Chosen Answer
Please log in to answer
Your query is much more complicated than it needs to be. This should work:
SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE WHERE MACHINE.IP like "172.16.12.%" and MACHINE.NAME not like "TC%"
Answered 02/07/2018 by: chucksteel