I have 2 tables:
articles
id int auto_increment
title VARCHAR
desc VARCHAR
etc
tags
id int auto_increment
articleId int
tag Varchar
The idea is that articles have multiple tags.
I want to select an article with all of it's tags in a single field separated by a comma or something.
The result would look like:
title | desc | tags |
---------------------------------------
article1 | desc1 | Tech,Science |
article2 | desc2 | Drama,Tv,Funny |
I'm looking for help with the query to do this.
Here's what I have... I know it's not right... I'm guessing I need some kind of join and concatenation?
SELECT *
FROM portfolio.articles, portfolio.tags
WHERE articles.id = tags.articleId;
Any help would be great!