Solved

Query contains an illegal outer-join request

Posted on 1998-11-10
4
1,074 Views
Last Modified: 2008-03-03
Let's say I have table 'a', 'b' and 'c'.

Here is my select statement:

select *
from   a, b, c
where  a.id *= b.id
and    b.id *= c.id

I know it's bad, but is there a way to do it w/o creating
any temporary tables?  I just want to be able to do it in one select statement.
0
Comment
Question by:ivanh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:david_levine
ID: 1091202
Do you mean without MS SQL Server, behind the scenes creating a temporary table? Probably not... but your definitely right... it's a bad thing to do.

Maybe you could tell us what you want in a little more detail. Such as your real table names.

David


0
 
LVL 1

Accepted Solution

by:
kponder earned 100 total points
ID: 1091203
This will work if it is truely what you are trying to accomplish. Since you are using b.id in both joins (where clause) changing it to a in the second is a valid operation.

select *
from   a, b, c
where  a.id *= b.id
and    a.id *= c.id


If you did not intend for b.id to be used in both clauses the following example will work

select * from a
  left join b on a.id = b.id
  left join c on b.X = c.id      'substitute x with field name


0
 
LVL 2

Expert Comment

by:aliciaam
ID: 1091204
If what you want is to have all the rows this should work

select * from   a
union
select * from  b
union
select * from c

Union is a powerful operator when you request the same information from different tables. You could create a view to hold this information. Let me know if this is what you needed.
0
 
LVL 1

Author Comment

by:ivanh
ID: 1091205
The left join did the trick.  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to shrink a transaction log file down to a reasonable size.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question