forked from Skyflash/K1000-Database-Queries
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcomputer labels with spss .sql
20 lines (20 loc) · 1.11 KB
/
computer labels with spss .sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- Sub query finds computers with SPSS installed that have a label in the "Labs and Classrooms" group
-- Main query returns the list of labels for those computers
-- Originally used to find classrooms where SPSS was installed for display on a webpage
SELECT DISTINCT(LABELS) FROM
(SELECT MACHINE.NAME AS SYSTEM_NAME,
USER_LOGGED,
GROUP_CONCAT(DISTINCT SOFTWARE.DISPLAY_NAME SEPARATOR '\n') AS SOFTWARE_DISPLAY_NAME_GROUPED,
GROUP_CONCAT(LABEL.NAME SEPARATOR ',') AS LABELS
FROM MACHINE
LEFT JOIN MACHINE_SOFTWARE_JT ON (MACHINE_SOFTWARE_JT.MACHINE_ID = MACHINE.ID)
LEFT JOIN SOFTWARE ON (SOFTWARE.ID = MACHINE_SOFTWARE_JT.SOFTWARE_ID)
LEFT JOIN MACHINE_LABEL_JT ON (MACHINE_LABEL_JT.MACHINE_ID = MACHINE.ID )
LEFT JOIN LABEL ON (LABEL.ID = MACHINE_LABEL_JT.LABEL_ID AND LABEL.TYPE <> 'hidden')
LEFT JOIN LABEL_LABEL_JT on LABEL_LABEL_JT.CHILD_LABEL_ID = LABEL.ID
LEFT JOIN LABEL PARENTLABEL on (PARENTLABEL.ID = LABEL_LABEL_JT.LABEL_ID AND LABEL.TYPE <> 'hidden')
WHERE (SOFTWARE.DISPLAY_NAME like '%SPSS%')
AND PARENTLABEL.NAME = "Labs and Classrooms"
GROUP BY MACHINE.ID
ORDER BY SYSTEM_NAME) AS MACHINESWITHSOFTWARE
ORDER BY LABELS