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.
ASK A QUESTION
More mysql PHP QuestionsHow do i list a record in front that is recently added to the table?
First i created the log in page now i want to connect to the database from where username and password table is save.How i create the php codes to give relation between them?
How do I update the contents of a table row?
How do I find second highest value from a table?
I'm creating a table to store clients' info via PHP; can I make an inquiry field where the client can enter comments about their inquiry?