uramagget Posted July 14, 2008 Share Posted July 14, 2008 I've tried searching through the documentation of MySQL but the right words on how this is done exactly is just is not successful.. Basically here is my schema: Table: sprites --id --title --sheet_file --game --console --amount --author I want to do two things, though. For one, I want to have a MySQL query count the total amount in the Database. I have tried: SELECT amount FROM `sprites` AS COUNT Although I don't think that it displays the total 'amount' added... Next is the table displaying the submitters. I want to be able to display the submitters, though I want it to display the respectful amount of sprites that user has submitted, while ordering by the greatest amount first. Thanking in advance, and sorry if it sounded a bit..odd. Quote Link to comment Share on other sites More sharing options...
.josh Posted July 14, 2008 Share Posted July 14, 2008 Okay I'm no expert, but if I read that correct: 1) SELECT SUM(amount) AS count FROM sprites 2) SELECT author, count(amount) AS count FROM sprites GROUP BY author ORDER BY count DESC Quote Link to comment Share on other sites More sharing options...
uramagget Posted July 14, 2008 Author Share Posted July 14, 2008 Thanks very much. I changed the count() to a sum() for the 2nd one and it works splendidly. Again, thanks. 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.