I am trying to find the unique count of the domains using apps.
The below query does not fetch any results. However if run the same query without distinct it returns the counts
SELECT
apps, category, COUNT(distinct(domain)) as counts
FROM table1.techs
GROUP BY apps
distinct
is not a function, so the brackets serve no purpose:
SELECT
apps, category, COUNT(distinct domain) as counts
FROM table1.techs
GROUP BY apps, category
Also, more importantly, you must list all non-aggregated columns in the GROUP BY clause to get meaningful results, OR remove category
entirely from query.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.