Why in the following code does Vertica return an error that zip3 ambiguous? Since it is used as the key for the left join, it must be equal for both tables.
SELECT zip, zip3, city, zip3_name
FROM zip_codes
LEFT JOIN zip3_codes
USING (zip3);
This generates the following error:
Query 1 ERROR: ERROR: Column reference "zip3" is ambiguous
DETAIL: Reference "zip3" could refer to either "public.zip_codes.zip3" or "public.zip3_codes.zip3"
I can resolve this by selecting either zip.zip3 or zip3.zip3 or COALESCE(zip.zip3, zip3.zip3) but I'm curious why this would be necessary.