Nessun problema, le richieste possono comunque essere utili ad altri.
Quindi potrebbe essere possibile, ma dovresti chiedere a qualcuno più esperto di me (probabilmente chatgpt o altri ^^)
Purtroppo, SQL funziona riga per riga.
Non sono in grado di tenere questo tipo di presentazione.
Ecco cosa ha suggerito il gatto, dovresti provarlo anche tu
Il mio modello ha una sola area, quindi non posso garantire il risultato.
Codice: Seleziona tutto
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;
Distinti saluti