I'm working on a Notebook for my website. Every entry has one or more category's. The MySQL Database looks like this:
Entry <- Where the Values (text, etc) and ID from the Entry's are stored
EntCat <- Where the Entry-ID and the Category-ID are put together
The Query, which is used to show all the latest entry's (on the start-site) looks like this:
SELECT bb_eintrag.headline, bb_eintrag.datum, bb_eintrag.preview, bb_kategorie.name AS "kategorie", bb_eintrag.id FROM bb_eintrag, bb_kategorie, bb_ein_kat WHERE bb_eintrag.id = bb_ein_kat.ein_id AND bb_kategorie.id = bb_ein_kat.kat_id ORDER BY bb_eintrag.datum DESC LIMIT 0,20
Now, it works wonderful with entry's with only one category. As soon as I have an entry with two or more category's, it's shown twice (one line for each category).
My question now:
What can I do to get the Entry's with two or more category's to be shown in one line (like all category-names in one field or something). I'm thinking of a join, which puts all the category's from the "category"-table in one row in the result-set.
Hope you understand what i mean