How do I group the results of a mysql query?
Here is how the query might look:
SELECT columns FROM Table WHERE clause GROUP BY column ORDER BY column
Common mistakes are to apply the GROUP BY either before the WHERE clause or after the ORDER BY - make sure you get it right.
Also remember that you are returning aggregate data rather than every result as an individual row, therefore it can take a little bit of careful thinking as to when you should use GROUP BY and a realisation of what will be returned when you do.
Comment on this Question and Answer >>>
ASK A QUESTION
More mysql PHP Questions
My website www.quicheandpie.com has navigation buttons which were added by going to admin/categorylist and adding a category. I can add category = navigation buttons and update them, but I can not delete them. Any ideas how I can find where the infoWhy will this statement not print a column with "lastname space firstname"? Print " .$info['businessname'] "; Print " .$info['firstname']. " " .$info['lastname'] "; I want to see 2 columns - a
What is difference between mysql_fetch_array and mysql_fetch_object?
How do I delete a row from a table?
How do I insert the date into my table?
