SQL not recognising table columns in ON statement

39 Views Asked by At

I have this SQL query:

SELECT "Segments.Id", "AggregatedValues.Segment"
FROM "Segments"
INNER JOIN "AggregatedValues" ON "Segments.Id" = "AggregatedValues.Segment"; 

And I get the following error:

ERROR:  column "Segments.Id" does not exist
LINE 1: ... FROM "Segments" INNER JOIN "AggregatedValues" ON "Segments....
                                                             ^
SQL state: 42703
Character: 99

This is EXTREMELY weird because the column DOES EXIST. The proof is that when selecting the column in the SELECT statement, no errors are thrown. It is also weird because if I change the order and say ON "AggregatedValues.Segment" = "Segments.Id" instead of ON "Segments.Id" = "AggregatedValues.Segment" then AggregatedValues.Segment appears as non existent even tho it also exists.

Any idea? I'm going mad

Thank you very much!!!!

0

There are 0 best solutions below