by
Bobby Cannon
July 07, 2010 07:34 PM
MySQL has the function group_concat that allows one to condense a set of rows into one single row by concatenating the list of values.
This is very useful when storing "Categories" or "Breadcrumbs". I needed the code for storing my content categories. I will list the example data.
| ID |
Name |
Parent |
| 1 |
Programming |
0 |
| 2 |
Operating Systems |
0 |
| 3 |
C# (C Sharp) |
1 |
| 4 |
Vista |
2 |
So what you end up getting is...
Operating Systems
Operating Systems :: Vista
Programming
Programming :: C# (C Sharp)