No worries, the requests can still be useful to others.
So it might be possible, but you'd have to ask someone more knowledgeable than me (probably chatgpt or others ^^)
Unfortunately, SQL works line by line.
I am not capable of giving this type of presentation.
Here's what the cat suggested, you should try it out on your end
My model only has one area, so I can't really guarantee the result.
Code: Select all
SELECT
dnsdomain,
affichage
FROM (
SELECT
h.dnsdomain,
h.dnsdomain || ' - ' || COUNT(*) || ' machines' AS affichage,
0 AS ordre,
'' AS tri
FROM hosts AS h
JOIN hostauditdata AS ha
ON h.uuid = ha.host_id
WHERE
h.os_name ~* '^Windows 10'
AND ha.value_section = 'w11-requirements'
AND ha.value_key = 'result'
AND ha.value ?& '{CAPABLE}'
GROUP BY h.dnsdomain
UNION ALL
SELECT
h.dnsdomain,
' ' || h.computer_name AS affichage,
1 AS ordre,
h.computer_name AS tri
FROM hosts AS h
JOIN hostauditdata AS ha
ON h.uuid = ha.host_id
WHERE
h.os_name ~* '^Windows 10'
AND ha.value_section = 'w11-requirements'
AND ha.value_key = 'result'
AND ha.value ?& '{CAPABLE}'
) AS resultats
ORDER BY
dnsdomain,
ordre,
tri;
Best regards