Since the 'id' column in both tables so, you have to specify the table for the name property in the where clause you're referring to .