Query returning Union of two tables I'm trying to retrieve data from a table using multi-column subquery but it unions the result from both tables. I'm unable to modify it to get actual results.
Here is my query

select * 
from   Recipe, user_plan 
where  Recipe.id in (select meal_number 
                     from user_plan 
                      where week_id=(select max(week_id) 
                                     from user_plan 
                                     where user_id=:user_id))


Recipe Structure





user_plan structure

It should return 2 rows as per my expectations and data available in tables but it is returning 10 rows.Please help me figure this out. Thanks.
I'm using mysql-server on ubuntu
I think you are missing user id condition in the outer query.

select 
* FROM 
user_plan inner join receipe
on a.receipe_id = b.id
where a.user_id =:user_id and b.week_id  
= ( SELECT max(week_id) FROM user_plan where user_id=:user_id)