subquery - join using in mysql

SELECT sports_name
FROM sports
WHERE id
IN (

SELECT sports_id
FROM sports_key
WHERE user_id =1
)

In this query we have selected field(sports_id) from the table(sports_key) and also we checed the field(user_id) This process has been done in subquery. Then finally, we have selected field (sports_name) from the table (sports_key) according to receiving field (id) values from subquery.

Posted by

Leave a Reply

You must be logged in to post a comment.