Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find max value of query using group by

Status
Not open for further replies.

dognobbler

Programmer
Jul 4, 2003
46
GB
When I run the following query

select count( username) as count, username
from friends
where status="validated"
group by username
order by count;

it gives me a list of each username in the and how many times it appears in the friends table

Can anyone tell me how to rewrite this query so that it tells me which username appeared the most times in the friends table.

Thanks

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top