PostgreSQL error code
PostgreSQL error 42702
42702 is the SQLSTATE PostgreSQL reports for ambiguous column, in class 42, Syntax Error or Access Rule Violation.
| SQLSTATE | 42702 |
|---|---|
| Condition name | ambiguous_column |
| Class | 42 — Syntax Error or Access Rule Violation |
Reproduce it, then fix it
These are the queries from the guide below. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT id, first_name, status, total_amount FROM demo.customers JOIN demo.orders ON orders.customer_id = customers.id;
SELECT o.id, c.first_name, o.status, o.total_amount FROM demo.customers c JOIN demo.orders o ON o.customer_id = c.id;