Column 'user_id' in field list is ambiguous

It means that both tables in the query have the column user_id.

You need to specify which one you want to get in the SELECT statement like SELECT username, image, re.user_id


column user_id is in both table_reviews, table_users tables.

You need to specify columns with table alias name also.

SELECT username, image, us.user_id FROM table_users AS us
JOIN table_reviews AS re
ON re.user_id = us.user_id
WHERE us.user_id = 1 AND
re.review_id= 1

Tags:

Mysql

Sql