I’m trying to get more values in a column and I’m testing it in phpMyAdmin:
I have a table Nieuws
that contains in this case ID
and a Title
.
I have a table called Nieuws_tags
where I give multiple tags to a item in column Nieuws
.
table Nieuws_tags
The final column is called Tags
that contains ID
and Beschrijving
Table Tags
Here is what I currently have:
SELECT * FROM (`Nieuws`) JOIN `Tags` ON `Tags`.`ID` = `Nieuws`.`ID`
WHERE `Tags`.`ID` = 1
1 | Titel 1 | 1 | QBNL
Right now I only get one value back QBNL
, but I gave it two values QBNL and QBBC. I’m pretty sure that my code is wrong but hopefully someone can help me.
EDIT: What I want to achieve:
2
Answers
You need to bring in junction table
Nieuws_tags
:Below would be the query if you need all the entries from tags.