Reputation: 33
I want to show the college name and num of applications comes to each college and show most application received college as first position in MySQL query?
This is sample table, clg
is college name and application_name
column must be count()
and highest value field must be show on top
My results must be like this....
Upvotes: 0
Views: 95
Reputation: 1270493
I am answering this because the columns in a select
should be unique, particularly when they are referenced in the order by
clause. The query should look more like:
SELECT s.clg, count(*) as cnt
FROM sample s
GROUP BY s.clg
ORDER BY cnt DESC ;
Upvotes: 0
Reputation: 579
try this,
SELECT `clg`,count(`clg`) AS clg
FROM demo
GROUP BY `clg`
ORDER BY clg DESC
Upvotes: 3