आप UNION
. का उपयोग करके प्रत्येक समूहीकृत क्वेरी को अन्य के साथ जोड़ सकते हैं . प्रत्येक सबक्वेरी में अप्रयुक्त कॉलमों को NULL
. से भरें ।
SELECT FirstName, LastName, NULL AS Country, NULL AS City, NULL AS BirthMonth, COUNT(*) AS count
FROM my_table
GROUP BY FirstName, LastName
UNION ALL
SELECT NULL, NULL, Country, City, NULL, COUNT(*)
FROM my_table
GROUP BY Country, City
UNION ALL
SELECT NULL, NULL, NULL, NULL, BirthMonth, COUNT(*)
FROM my_table
GROUP BY BirthMonth