A query to find the most popular sponsors
My website users are given their own referral address they can put on their website. I am trying to determine which of my users bring the most number of new signups. Here is the query I came up with:
select sponsor, count(sponsor) as total from users group by sponsor order by total desc;
But when I try to throw in firstname and lastname into the query, to find out the names of those who refer the most, it screws up the data. How can the above query be tweaked so that it provides an additional column of firstname lastname?