And how can we use it ? I'm searching for examples or documentation about it but I can't find any...
Can someone explain it please ?
Sorry for that ⇧ , I'm no dev but I wanna try
-
☆ A M B ☆
- 24,524 Posts
These are SQL filters added to the final SQL that is used to fetch the data from the database.
In rough terms, "group by" will return only one record for all of the rows that contain the "group by" value in the specified field. For example, if you have a table that stored user purchases, and you want to know how many users have made purchases, if you "group by" user it will return one row for each user. You could also use the same "group by" to get a list of users and a count of how many purchases each user made.
Here's a nice discussion.
http://www.databasejournal.com/features/mysql/article.php/3469351/The-HAVING-and-GROUP-BY-SQL-clauses.htm
Also see
http://www.w3schools.com/sql/sql_having.asp