SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in field list is ambiguous code example
Example 1: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in field list is ambiguous
SQL supports qualifying a column by prefixing the reference with either the
full table name:
SELECT tbl_names.id, tbl_section.id, name, section
FROM tbl_names
JOIN tbl_section ON tbl_section.id = tbl_names.id
...or a table alias:
SELECT n.id, s.id, n.name, s.section
FROM tbl_names n
JOIN tbl_section s ON s.id = n.id
Example 2: column in field list is ambiguous
SELECT n.id, s.id, n.name, s.section
FROM tbl_names n
JOIN tbl_section s ON s.id = n.id