I am trying to select a user who has MAX microposts counters:
SELECT "name", count(*) FROM "users"
INNER JOIN "microposts" ON "microposts"."user_id" = "users"."id"
GROUP BY users.id
and it returns
"Delphia Gleichner";15
"Louvenia Bednar IV";10
"Example User";53
"Guadalupe Volkman";20
"Isabella Harvey";30
"Madeline Franecki II";40
But I want to choose only "Example User";53, (a user who has MAX number of microflows)
I tried to add HAVING MAX(count*), but that didn't work.
source
share