A
A
Anon33632020-05-15 09:22:50
SQL
Anon3363, 2020-05-15 09:22:50

How to find MAX() from COUNT()?

SELECT COUNT(bjishk_masnagitutyun.masnagitutyun_id),masnagitutyun_id
FROM bjishk_masnagitutyun
GROUP BY masnagitutyun_id
ORDER BY masnagitutyun_id DESC LIMIT

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Swartalf, 2020-05-15
@Swartalf

Depending on the database can be done via HAVING

L
Lazy @BojackHorseman, 2020-05-15
SQL

ORDER BY COUNT(masnagitutyun_id) DESC LIMIT 1
if there is an index on masnagitutyun_id, it will work quickly in almost all subds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question