Patrick
Patrick

Reputation: 15

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

Upvotes: 0

Views: 76

Answers (2)

zkanoca
zkanoca

Reputation: 9918

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

Upvotes: 1

musical_coder
musical_coder

Reputation: 3896

You need to specify the table name in front of form_name: i.e., 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.

Upvotes: 2

Related Questions