I have a table called content
that I join with a few other tables (translates
and tags
, etc). If I have 3 rows for translation and 4 rows for the tags, the result will be 12 rows which will be bigger when there is another table.
Also displaying them on the front side becomes a bit hard. Instead of having 12 rows, I need to have 8 rows as following:
Current behavior: The query result is something like this: index 0 to 12 contains just a single content (with different translations and tags with the same content_id
)
Expected behavior: The result must be like this: every index contains just a single content, which contains the translations and tags, something like this:
0 => content=>[...], translations=>[...], tags=>[...]
Is there any built-in way in mysql
to handle such a thing? Or I must handle it in php
via loops? How can it be possible?