Table Schema for the
id id1 1 2 1 3 2 1
I count the total number of Likes for each student with this:
select id,count(*) from friends group by id
I have to find the students with the maximum number of Likes, so I use this query as a temp table:
select * from ( select f1.id,count(*) as count1 from Likes f1 group by id ) temp where not exists ( select f2.id,count(asterick) as count2 from Likes f2 group by f2.id having count2 > temp.count1 )
It returns all of the records. Can anyone point out what I am doing wrong in this query?