You can use IN. Like this:
SELECT t_posts.id, t_posts.title
FROM t_posts, t_keywords, t_posts_keywords
WHERE t_posts.id = t_posts_keywords.id_post
AND t_keywords.id = t_posts_keywords.id_keyword
AND t_keywords.keyword IN("climate","recycling")
GROUP BY t_posts.id
You can also use ORbetween. Like this:
SELECT t_posts.id, t_posts.title
FROM t_posts, t_keywords, t_posts_keywords
WHERE t_posts.id = t_posts_keywords.id_post
AND t_keywords.id = t_posts_keywords.id_keyword
AND
(
t_keywords.keyword ="climate" OR
t_keywords.keyword ="recycling"
)
GROUP BY t_posts.id
source
share