Re: [SQL] Question on OUTER JOINS.

2003-06-28 Thread Tom Lane
Ludwig Lim <[EMAIL PROTECTED]> writes: >Is there way of rewritting : >SELECT a.status, >employee_id >FROM permission a LEFT JOIN > ( SELECT * FROM employee WHERE employee_id > =5) as b ON (a.status = b.status) >WHERE status='test' > into a query that has

Re: [SQL] Question on OUTER JOINS.

2003-06-28 Thread Bruno Wolff III
On Fri, Jun 27, 2003 at 23:16:18 -0700, Ludwig Lim <[EMAIL PROTECTED]> wrote: > >Is there way of rewritting : >SELECT a.status, >employee_id >FROM permission a LEFT JOIN > ( SELECT * FROM employee WHERE employee_id > =5) as b ON (a.status = b.status) >WH

Re: [SQL] Question on OUTER JOINS.

2003-06-27 Thread Ludwig Lim
--- Tom Lane <[EMAIL PROTECTED]> wrote: > Ludwig Lim <[EMAIL PROTECTED]> writes: > > 1) Is the ON clause of an OUTER JOIN always > > evaluated first before the WHERE clause? > > No; the planner will do whatever it thinks is the > most efficient way > (assuming it can prove that the reordering i

Re: [SQL] Question on OUTER JOINS.

2003-06-27 Thread Tom Lane
Ludwig Lim <[EMAIL PROTECTED]> writes: > 1) Is the ON clause of an OUTER JOIN always > evaluated first before the WHERE clause? No; the planner will do whatever it thinks is the most efficient way (assuming it can prove that the reordering it wants to do won't change the query result). > Is t

[SQL] Question on OUTER JOINS.

2003-06-27 Thread Ludwig Lim
Hi: 1) Is the ON clause of an OUTER JOIN always evaluated first before the WHERE clause? 2) Given the ff SQL statement : SELECT employee_id, a.status as status FROM permissions a LEFT JOIN (select * from employee where employee_id = 3) as b on (a.status=b.status) WH