Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

The table is an inner member of an outer-join clause...(etc)

"Pat" <pwang@uclink.berkeley.edu> wrote:
>
>I have the error msg above when I run the query statement like this.
>I can understand that the inner member of an outer-join may have NULL
>as value, which may cause error in the equal join.
>
>
>select a.* From entity a,
>(select b.cl_co_id from company_location b, location_role c where b.coloc_id
>= c.lr_loc_id) dd
>where a.co_id *=dd.cl_co_id
>
>===========================================
>But if I do the equal join first, like in my above SQL statement,
>then do the outerjoin, why is this not acceptable? Does the SQL interpretter
>has executing order built into it? I am using Microsoft SQL Server 2000.
>So is building a temporary table to hold the equal join result is the only
>solution here?
>
>
>Thanks
>Pat
>

Pat,

That's far too hard for me, but I have noticed that SQL Server doesn't work
as well with the old-style joins as it does with the new JOIN clauses. You
might like to experiment with JOIN AND LEFT JOIN, which do seem to allow
you to control the sequence in which the joins are made (by parentheses around
the bits you want done first). If that's no good, post the relevant bits
of the table specs, some sample data, and the results you are trying to get.

Regards,
Simon Sellick.
[1479 byte] By [Simon Sellick] at [2007-11-9 21:09:53]