K1000: Machine Smart Labels
When I first set up our kbox, I set up machine labels based on IP ranges that would identify the location of a computer. I'm in a school district and equipment moves around sometimes and IP gives us some definite information on location on our network. Originally i created the labels using the wizard and there's a lot of extra junk in there. Now that I know a little more SQL, I'm wondering if I can simplify these queries to make it easier to manage and change them.
Here's the query created by the wizard:
select *, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,
UNIX_TIMESTAMP(MACHINE.LAST_SYNC) as LAST_SYNC_SECONDS
LEFT JOIN KBSYS.KUID_ORGANIZATION ON KUID_ORGANIZATION.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION ON SMMP_CONNECTION.KUID = MACHINE.KUID AND KUID_ORGANIZATION.ORGANIZATION_ID = 1
where (( (1 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP like '10.19%' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP like '10.19%')) ))
and here's my much simplified version:
where IP like '10.19.%'
Am I missing something? Is there a reason to use the first query instead of the second?