Seaquel
PostgreSQL error code

PostgreSQL error 42702

42702 is the SQLSTATE PostgreSQL reports for ambiguous column, in class 42, Syntax Error or Access Rule Violation.

SQLSTATE42702
Condition nameambiguous_column
Class42 — 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;

How to fix it

In other databases

Source: PostgreSQL documentation, Appendix A