I'm sorry if I don't know the correct terminology but here we go:
I have a table with the following columns and rows:
------------------------------
| id | parent_id | type |
------------------------------
| 1 | 0 | text1 |
| 2 | 1 | text2 |
------------------------------
Now what I want is to select the type, but if the parent_id is not 0
I want the type to be the content of the type from it's parent +[ the type of itself ].
So the output for a select would in this case be:
----------------
| type |
----------------
| text1 |
| text1[text2] |
----------------
I was trying this with a concat and an if statement, but couldn't figure this out.
Can you help me out?