If I run this SQL code in my PostgreSQL database, it works fine:
select
e.type_id,
s.copy_destination || '\'
FROM
ebooks.ebooks e, ebooks.static_text s
WHERE
e.status_id = 1
But when I add the join, everything goes pear-shaped. So if I run:
select
e.type_id,
s.copy_destination || '\'
FROM
ebooks.ebooks e, ebooks.static_text s
join
ebooks.types y
on
e.type_id = y.type_id
WHERE
e.status_id = 1
I get this error message:
ERROR: invalid reference to FROM-clause entry for table "e"
LINE 11: e.type_id = y.type_id
^
HINT: There is an entry for table "e", but it cannot be referenced from this part of the query.
SQL state: 42P01
Character: 159
I've tried using the full reference (ebooks.eboooks.type_id) instead of just e, but nothing changed. I still got the "invalid reference to FROM-clause entry for table 'e'" - note that it still thinks I'm trying to reference table 'e'.
What am I doing wrong?