Answer the question
In order to leave comments, you need to log in
How to convert data of one table?
Hello. There are three tables article(id, title, text), tags(id, alias, name), articleTag. The last one is an intermediate table. The third table is needed to filter by tags and add tags to the article. article and tags have an id field, articleTag has an articleID and tagID field. These three tables are related.
This is how I filter them:
"SELECT * FROM `articleTag` AS aT LEFT JOIN `article` AS a ON(aT.articleID = a.id)
WHERE aT.tagID = 1"
Answer the question
In order to leave comments, you need to log in
select a.*
from `article` as a
join `articleTag` AS aT ON(aT.articleID = a.id)
join `Tags` as t ON (aT.tagID = t.id)
where t.alias = <условие>
"SELECT * FROM `articleTag` AS aT LEFT JOIN `article` AS a ON(aT.articleID = a.id)
WHERE aT.tagID in (select aa.id from `Tags` as aa where aa.alias = <условие>)"
So try
"SELECT *
FROM `articleTag` AS aT
INNER JOIN `article` AS a ON(aT.articleID = a.id)
INNER JOIN `tags` AS t ON(aT.tagID = t.id)
WHERE AND t.alias = 'find me'"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question