Difference between ON and WHERE in JOINs

From: Jean-Christophe Boggio <postgresql(at)thefreecat(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Difference between ON and WHERE in JOINs
Date: 2012-09-19 00:21:03
Message-ID: 50590FEF.3000406@thefreecat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm looking for an article that explains the difference between these
constructs IN POSTGRESQL (the rules seem to differ from one DB to another) :

SELECT A.*
FROM A
JOIN B ON a.id=b.id AND A.somefield='somevalue'

and

SELECT A.*
FROM A
JOIN B ON a.id=b.id
WHERE A.somefield='somevalue'

I have noticed big differences though I don't know the rules and I've
been bitten several times recently. Time to learn.

Thanks,

JC

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guilherme Rodrigues 2012-09-19 00:25:42 Re: Change key primary for key foreign
Previous Message Chris Travers 2012-09-19 00:17:56 Re: foreign key from array element