2

I am having a hard time finding what I am doing wrong here.

    select * from prog_log as g0, order_line as g1, logstat as g2
    inner join channel as g3 on g3.chn_serial = g0.log_chn_id

I am getting the following error:

    invalid reference to FROM-clause entry for table "g0"
    LINE 2: inner join channel as g3 on g3.chn_serial = g0.log_chn_id
                                                ^
    HINT:  There is an entry for table "g0", but it cannot be referenced from this part of the query.

From what I've read I need to do some kind of join on g0, g1, and g2, but my database doesn't have a common column between them, so I can't do a join.

Any help would be greatly appreciated.

1
  • Don't mix the ancient implicit joins and explicit JOIN operators Commented Aug 31, 2020 at 17:32

1 Answer 1

3

Commas in Postgres bind more weakly than JOIN expressions; change each comma in the FROM clause to CROSS JOIN. See the note in the relevant section of the docs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.