@Hanz Glad you got it fixed.
For others future reference, This command:
SELECT hostID from hosts WHERE hostID NOT IN (SELECT hmHostID FROM hostMAC WHERE hmPrimary=1);
can be changed into a command to delete all that it returns by simply changing select to delete like this:
DELETE hostID from hosts WHERE hostID NOT IN (SELECT hmHostID FROM hostMAC WHERE hmPrimary=1);