Jump to content

Using COUNT in queries


Porl123

Recommended Posts

I have a member's table with username, password, age, pet and DOB in and I'm trying to find the most popular pet. So I was wondering how I'd go about doing that. Any thoughts? Thanks for your help :)

 

assuming your table name is members

SELECT pets, count(pets) FROM members GROUP BY pets ORDER BY count(pets) DESC

 

the first row should contain the pet that is the most popular.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.