Skip to content

Instantly share code, notes, and snippets.

@jacksoneyton
Last active July 8, 2016 16:41
Show Gist options
  • Save jacksoneyton/6dfdf4c0aeb1c3c513edb011fcf4e115 to your computer and use it in GitHub Desktop.
Save jacksoneyton/6dfdf4c0aeb1c3c513edb011fcf4e115 to your computer and use it in GitHub Desktop.
SELECT `computers`.`name` AS 'PC Name',
`computers`.`ComputerID` AS 'Agent ID',
`computers`.`OS` AS 'OS',
`computers`.`LastContact` AS 'Last Contact',
COUNT(hotfixid) AS 'Updates Pending'
FROM `hotfix`
JOIN `computers`ON ( `hotfix`.`ComputerID` = `computers`.`ComputerID` )
JOIN clients ON (computers.clientid=clients.clientid)
WHERE `hotfix`.`Installed`=0 AND `hotfix`.`Approved`=1
AND clients.clientid NOT IN (33)
AND `computers`.`LastContact` > DATE_SUB(NOW(), INTERVAL 5 MINUTE)
AND computers.os NOT LIKE '%server%'
GROUP BY `computers`.`name` DESC
ORDER BY COUNT(hotfixid) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment