简体   繁体   中英

MYSQL Error 1052 issue - Unsure why this is wrong

I have read about this issue and I believe I have written this correctly, however I am still receiving the 1052 error message stating that column "form_name" in field list is ambiguous...

I have two tables form_status and F1

SELECT form_status.custom_id, F1.custom_id, form_name, uid 
FROM form_status 
JOIN F1 ON F1.custom_id=form_status.custom_id; 

Any help would be appreciated...

Thanks!

EDIT: I believe I have figured it out...I need to append the table name to ALL of the selected columns...however, when I read a few of other posts about this issue, I did not see this...

This is what I had changed:

SELECT form_status.custom_id, F1.custom_id, F1.form_name, F1.uid 
FROM form_status 
JOIN F1 ON F1.custom_id=form_status.custom_id; 

EDIT 2: I see! because form_status appears in both tables you need to tell mysql what table to grab the data from. Thanks a lot for the help guys! I appreciate it

You need to specify the table name in front of form_name : ie, form_status.form_name or F1.form_name .

This is because you have column form_name in both tables, so without the table name it's impossible to pick the right one.

form_name fields exist in both F1 and form_status tables. Clarify what form_name you are selecting:

form_status.form_name

OR

F1.form_name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM