Andrius
Andrius

Reputation: 21198

PostgreSQL INNER JOIN vs WHERE clause join

I thought INNER JOIN was equivalent to JOIN in WHERE clause. When I make join using WHERE clause, I get rows returned. But if I do INNER JOIN, then no rows are outputed. I get result that there are no matches. Am I mistaken, or I'm doing something wrong?

Are these joins equivalent?:

INNNER JOIN:

account_move_reconcile_line_applied amrla
INNER JOIN account_move_reconcile_line amrl ON (amrla.credit_line_id = amrl.id)
INNER JOIN account_move_reconcile amr ON (amrl.credit_reconcile_id = amr.id)
INNER JOIN account_move_line aml ON (aml.reconcile_partial_id = amr.id)
INNER JOIN res_partner rp ON (aml.partner_id = rp.id)

IN WHERE clause:

amrla.credit_line_id = amrl.id
and amrl.partner_id = rp.id
and amrl.credit_reconcile_id = amr.id
and aml.reconcile_id = amr.id

Upvotes: 0

Views: 1485

Answers (1)

Andrius
Andrius

Reputation: 21198

There was wrong ID in:

INNER JOIN account_move_line aml ON (aml.reconcile_partial_id = amr.id)

It should have been reconcile_id instead of reconcile_partial_id.

Upvotes: 1

Related Questions