Porl123 Posted July 29, 2008 Share Posted July 29, 2008 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 Quote Link to comment Share on other sites More sharing options...
TempleDMDKrazd Posted July 29, 2008 Share Posted July 29, 2008 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 31, 2008 Share Posted July 31, 2008 the first row should contain the pet that is the most popular. Assuming there isn't a tie. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.