MySQL Group By
Data can be grouped by “group by” key-word.
1 |
group by FieldName; |
tbllibrary table structure and current status of the tbllibrary.
1 |
select * from tbllibrary; |
![](http://localhost/wordpress/wp-content/uploads/2020/12/ice_screenshot_20201212-221759.png)
Group by the writer and count the records for each writer.
1 |
select writer, count(*) from tbllibrary group by writer; |
![](http://localhost/wordpress/wp-content/uploads/2020/12/ice_screenshot_20201212-224552.png)
Explanation
There are four groups by “writer” in the table “tbllibrary”;