Answer the question
In order to leave comments, you need to log in
How in MySQL to make conditions for selection in two tables?
There are two tables, one contains users' topics, and the other contains comments on topics and the status of topics (active \ not) Like
this:
Topics:
topic_id | user_id
Comments:
comment_id | topic_id | active
topic id of two tables linked. How to write a query so that it gives out all the info of comments and topics for topics whose user_id = 2 and comment status active = 1?
Answer the question
In order to leave comments, you need to log in
SELECT *
FROM topics t, comments c
WHERE t.topic_id = c.topic_id AND t.user_id = 2 AND c.active = 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question