Marcos Tadeu marcos@telecom.uff.br writes:
1 + 2 + 3 = lost APs ! we need to search MACs and confirm that they are on correct VLAN
Depending on what you want, and given that you have a long list of MAC addresses to search for, you might able to do something like this:
SELECT mac, n.sysname AS switch, i.ifname AS interface, i.vlan AS vlan FROM cam JOIN netbox n USING (netboxid) JOIN interface i ON (cam.netboxid = i.netboxid AND cam.ifindex = i.ifindex) WHERE end_time >= 'infinity' AND mac IN ('00:0b:ad:c0:ff:ee', '00:00:ca:fe:ba:be', ... );
But that list might get really long if had over 900 MAC addresses to search for. You might want to consider dumping the list of MAC addresses into a temporary table and joining with that instead of putting everything into the query each time.