Created
November 27, 2018 14:44
-
-
Save jfrantz1-r7/774da56e9b140df21a2c02610ab47d32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT dsite."name" AS "Site", | |
| da.ip_address, | |
| da.host_name, | |
| dos.description AS "OS", | |
| os.certainty_max | |
| FROM fact_asset AS fa | |
| JOIN dim_asset da | |
| ON da.asset_id = fa.asset_id | |
| JOIN (SELECT asset_id, | |
| Max(certainty) AS certainty_max | |
| FROM dim_asset_operating_system | |
| GROUP BY asset_id) os | |
| ON fa.asset_id = os.asset_id | |
| AND os.certainty_max < 1 | |
| JOIN dim_operating_system AS dos | |
| ON da.operating_system_id = dos.operating_system_id | |
| JOIN dim_site_asset AS dsa | |
| ON fa.asset_id = dsa.asset_id | |
| JOIN dim_site AS dsite | |
| ON dsa.site_id = dsite.site_id | |
| GROUP BY dsite."name", | |
| da.ip_address, | |
| da.host_name, | |
| dos.description, | |
| os.certainty_max | |
| ORDER BY "site", | |
| da.ip_address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment