https://techygeekshome.info/2014/01/sccm-2012-query-for-configmgr-clients/
SCCM - SQL Query for ConfigMgr clients not upgraded to CM2012 (v5)