I would like to select data from a Mysql table as grouped data. I have a table like below in MySql Database.
+-----------------------+
| date name |
+-----------------------+
| 12/02/2015 computer |
| 12/02/2015 mouse |
| 12/02/2015 Book |
| 13/02/2015 Paper |
| 13/02/2015 Pen |
| 13/02/2015 Pencil |
+-----------------------+
I would like to display data like below.
+---------------+
| date |
+---------------+
| 12/02/2015 |
+---------------+
| name |
+---------------+
| computer |
| mouse |
| Book |
+---------------+
| date |
+---------------+
| 13/02/2015 |
+---------------+
| name |
+---------------+
| Paper |
| Pen |
| Pencil |
+---------------+
I need the Query. Thanks
Update
I would not like to use group_concat()
.I think there are other ways to do that. There are some limitation of group_concat()
like it can concate certain amount of text and I am facing that type of problem.
I think here are some solutions MySQL Query with Group By
Thanks