RE: Outer join in SQL server - A very simple question

2003-06-25 Thread Naveen Nahata
Thanx to all. As pointed by you guys, I learned the "ANSI-92 standard join
syntax" and it works perfectly with that.

And Darell thanx for the resources.

Regards
Naveen


> -Original Message-
> From: Darrell Landrum [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 25, 2003 7:44 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Re: Outer join in SQL server - A very simple question
> 
> 
> I don't know the answer but can suggest some resources:
> www.sqlmag.com 
> www.sqlpass.org/forums 
> www.sqlservercentral.com/forum 
> 
> Just to be sure, I went to each of these this morning to make 
> sure they
> are still live.
> 
> 
> >>> [EMAIL PROTECTED] 06/25/03 02:49AM >>>
> Sorry for the SQL Server post, working on SQL Server for the first
> time, and
> this list is my only resource as of now. I'm reading the SQL Server
> join
> syntax and trying it myself. Meanwhile, If i can get some expert help,
> it
> will be more than useful
> 
> I'm simplifying the problem with the help of these test tables.
> 
> CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
> CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
> CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
> CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));
> 
> INSERT INTO t1 VALUES ('A', 'AA', '');
> INSERT INTO t1 VALUES (null, '', '');
> 
> INSERT INTO t2 VALUES ('A', 'BB');
> 
> INSERT INTO t3 VALUES ('A', 'CC');
> 
> INSERT INTO t4 VALUES ('A', 'DD');
> 
> Table t1 refers to t2(through a) and t4(through a2) directly and t2
> refers to
> t3(through b). 
> 
> I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
> irrespective of whether the value is there in the other tables or
> not(outer-join of course)
> 
> I wrote this query in Oracle and it works
> 
> SQL> SELECT a1, b1, c1, d1
>   2  FROM   t1, t2, t3, t4
>   3  WHERE  t1.a = t2.b(+)
>   4  ANDt2.b = t3.c(+)
>   5  ANDt1.a2 = t4.d
>   6  /
> 
> A1 B1 C1 D1
> -- -- -- --
> AA BB CC DD
>  DD
> 
> I substituted the "+" with the "*" to use it in SQL Server which made
> my
> query look like this:
> 
> SELECT a1, b1, c1, d1
> FROM   t1, t2, t3, t4
> WHERE  t1.a =* t2.b
> ANDt2.b =* t3.c
> ANDt1.a2 = t4.d
> 
> But it fails with the error:
> 
> "The table 't1' is an inner member of an outer-join clause. This is
> not
> allowed if the table also participates in a regular join clause."
> 
> How to overcome this? Or is the query wrong?
> 
> Regards
> Naveen
> 
> 
> DISCLAIMER:
> This message (including attachment if any) is confidential and may be
> privileged. Before opening attachments please check them for 
> viruses and
> defects. MindTree Consulting Private Limited (MindTree) will not be
> responsible for any viruses or defects or any forwarded attachments
> emanating either from within MindTree or outside. If you have received
> this message by mistake please notify the sender by return  e-mail and
> delete this message from your system. Any unauthorized use or
> dissemination of this message in whole or in part is strictly
> prohibited.  Please note that e-mails are susceptible to change and
> MindTree shall not be liable for any improper, untimely or incomplete
> transmission.
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net 
> -- 
> Author: Naveen Nahata
>   INET: [EMAIL PROTECTED] 
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com 
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: Darrell Landrum
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing 

RE: Outer join in SQL server - A very simple question

2003-06-25 Thread Rudy Zung

IIRC, the "*=" from Sybase and SQLServer is placed on the
opposite side of Oracle's "(+)" for the same affect.
i.e.
ORACLE:
   select a.*,
  b.*
  from a,
   b
  where a.x(+) = b.x
Sybase/SQLServer:
   select a.*,
  b.*
  from a,
   b
  where a.x =* b.x
The above 2 queries are equivalent; you can't just
replace the (+) with a *; you will also have to move
it to the other side of the equal sign.

-Original Message-
Sent: Wednesday, June 25, 2003 11:50 AM
To: Multiple recipients of list ORACLE-L


This does the same...

SELECT a1, b1, c1, d1
FROM
t1
left join t2 on t1.a=t2.b
left join t3 on t2.b=t3.c
left join t4 on t1.a2=t4.d

Ade

-Original Message-
Sent: 25 June 2003 12:55
To: Multiple recipients of list ORACLE-L


Please read "INSERT INTO t4 VALUES ('A', 'DD');" as "INSERT INTO t4 VALUES
('', 'DD');" in my previous mail.

Regards
Naveen

> -Original Message-
> From: Naveen Nahata 
> Sent: Wednesday, June 25, 2003 1:20 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Outer join in SQL server - A very simple question 
> 
> 
> Sorry for the SQL Server post, working on SQL Server for the 
> first time, and
> this list is my only resource as of now. I'm reading the SQL 
> Server join
> syntax and trying it myself. Meanwhile, If i can get some 
> expert help, it
> will be more than useful
> 
> I'm simplifying the problem with the help of these test tables.
> 
> CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
> CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
> CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
> CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));
> 
> INSERT INTO t1 VALUES ('A', 'AA', '');
> INSERT INTO t1 VALUES (null, '', '');
> 
> INSERT INTO t2 VALUES ('A', 'BB');
> 
> INSERT INTO t3 VALUES ('A', 'CC');
> 
> INSERT INTO t4 VALUES ('A', 'DD');
> 
> Table t1 refers to t2(through a) and t4(through a2) directly 
> and t2 refers to
> t3(through b). 
> 
> I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
> irrespective of whether the value is there in the other tables or
> not(outer-join of course)
> 
> I wrote this query in Oracle and it works
> 
> SQL> SELECT a1, b1, c1, d1
>   2  FROM   t1, t2, t3, t4
>   3  WHERE  t1.a = t2.b(+)
>   4  ANDt2.b = t3.c(+)
>   5  ANDt1.a2 = t4.d
>   6  /
> 
> A1 B1 C1 D1
> -- -- -- --
> AA BB CC DD
>  DD
> 
> I substituted the "+" with the "*" to use it in SQL Server 
> which made my
> query look like this:
> 
> SELECT a1, b1, c1, d1
> FROM   t1, t2, t3, t4
> WHERE  t1.a =* t2.b
> ANDt2.b =* t3.c
> ANDt1.a2 = t4.d
> 
> But it fails with the error:
> 
> "The table 't1' is an inner member of an outer-join clause. 
> This is not
> allowed if the table also participates in a regular join clause."
> 
> How to overcome this? Or is the query wrong?
> 
> Regards
> Naveen
> 
> 
> DISCLAIMER:
> This message (including attachment if any) is confidential 
> and may be privileged. Before opening attachments please 
> check them for viruses and defects. MindTree Consulting 
> Private Limited (MindTree) will not be responsible for any 
> viruses or defects or any forwarded attachments emanating 
> either from within MindTree or outside. If you have received 
> this message by mistake please notify the sender by return  
> e-mail and delete this message from your system. Any 
> unauthorized use or dissemination of this message in whole or 
> in part is strictly prohibited.  Please note that e-mails are 
> susceptible to change and MindTree shall not be liable for 
> any improper, untimely or incomplete transmission.
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: Naveen Nahata
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be rem

RE: Outer join in SQL server - A very simple question

2003-06-25 Thread Pardee, Roy E
I think this does what you want:

   select a1, b1, c1, d1
   from  t1 left join t2 on t1.a = t2.b
 left join t3 on t2.b = t3.c 
 left join t4 on t1.a2 = t4.d ;

NB--I don't think this is necessarily a mssql question--oracle 9i (at least)
supports the same ANSI-92 standard join syntax.  See, e.g.,
http://www.nyoug.org/9ijoin.pdf

The way I remember whether to do a left or a right outer join is I picture
an arrow pointing to the table I want 'preserved' (that is, the one I want
to see rows from even where there's no corresponding row in the other
table).

HTH,

-Roy

Roy Pardee
Programmer/Analyst/DBA
SWFPAC Lockheed Martin IT
Extension 8487

-Original Message-
Sent: Wednesday, June 25, 2003 4:55 AM
To: Multiple recipients of list ORACLE-L


Please read "INSERT INTO t4 VALUES ('A', 'DD');" as "INSERT INTO t4 VALUES
('', 'DD');" in my previous mail.

Regards
Naveen

> -Original Message-
> From: Naveen Nahata 
> Sent: Wednesday, June 25, 2003 1:20 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Outer join in SQL server - A very simple question 
> 
> 
> Sorry for the SQL Server post, working on SQL Server for the 
> first time, and
> this list is my only resource as of now. I'm reading the SQL 
> Server join
> syntax and trying it myself. Meanwhile, If i can get some 
> expert help, it
> will be more than useful
> 
> I'm simplifying the problem with the help of these test tables.
> 
> CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
> CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
> CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
> CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));
> 
> INSERT INTO t1 VALUES ('A', 'AA', '');
> INSERT INTO t1 VALUES (null, '', '');
> 
> INSERT INTO t2 VALUES ('A', 'BB');
> 
> INSERT INTO t3 VALUES ('A', 'CC');
> 
> INSERT INTO t4 VALUES ('A', 'DD');
> 
> Table t1 refers to t2(through a) and t4(through a2) directly 
> and t2 refers to
> t3(through b). 
> 
> I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
> irrespective of whether the value is there in the other tables or
> not(outer-join of course)
> 
> I wrote this query in Oracle and it works
> 
> SQL> SELECT a1, b1, c1, d1
>   2  FROM   t1, t2, t3, t4
>   3  WHERE  t1.a = t2.b(+)
>   4  ANDt2.b = t3.c(+)
>   5  ANDt1.a2 = t4.d
>   6  /
> 
> A1 B1 C1 D1
> -- -- -- --
> AA BB CC DD
>  DD
> 
> I substituted the "+" with the "*" to use it in SQL Server 
> which made my
> query look like this:
> 
> SELECT a1, b1, c1, d1
> FROM   t1, t2, t3, t4
> WHERE  t1.a =* t2.b
> ANDt2.b =* t3.c
> ANDt1.a2 = t4.d
> 
> But it fails with the error:
> 
> "The table 't1' is an inner member of an outer-join clause. 
> This is not
> allowed if the table also participates in a regular join clause."
> 
> How to overcome this? Or is the query wrong?
> 
> Regards
> Naveen
> 
> 
> DISCLAIMER:
> This message (including attachment if any) is confidential 
> and may be privileged. Before opening attachments please 
> check them for viruses and defects. MindTree Consulting 
> Private Limited (MindTree) will not be responsible for any 
> viruses or defects or any forwarded attachments emanating 
> either from within MindTree or outside. If you have received 
> this message by mistake please notify the sender by return  
> e-mail and delete this message from your system. Any 
> unauthorized use or dissemination of this message in whole or 
> in part is strictly prohibited.  Please note that e-mails are 
> susceptible to change and MindTree shall not be liable for 
> any improper, untimely or incomplete transmission.
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: Naveen Nahata
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other infor

Re: Outer join in SQL server - A very simple question

2003-06-25 Thread Darrell Landrum
I don't know the answer but can suggest some resources:
www.sqlmag.com 
www.sqlpass.org/forums 
www.sqlservercentral.com/forum 

Just to be sure, I went to each of these this morning to make sure they
are still live.


>>> [EMAIL PROTECTED] 06/25/03 02:49AM >>>
Sorry for the SQL Server post, working on SQL Server for the first
time, and
this list is my only resource as of now. I'm reading the SQL Server
join
syntax and trying it myself. Meanwhile, If i can get some expert help,
it
will be more than useful

I'm simplifying the problem with the help of these test tables.

CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));

INSERT INTO t1 VALUES ('A', 'AA', '');
INSERT INTO t1 VALUES (null, '', '');

INSERT INTO t2 VALUES ('A', 'BB');

INSERT INTO t3 VALUES ('A', 'CC');

INSERT INTO t4 VALUES ('A', 'DD');

Table t1 refers to t2(through a) and t4(through a2) directly and t2
refers to
t3(through b). 

I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
irrespective of whether the value is there in the other tables or
not(outer-join of course)

I wrote this query in Oracle and it works

SQL> SELECT a1, b1, c1, d1
  2  FROM   t1, t2, t3, t4
  3  WHERE  t1.a = t2.b(+)
  4  ANDt2.b = t3.c(+)
  5  ANDt1.a2 = t4.d
  6  /

A1 B1 C1 D1
-- -- -- --
AA BB CC DD
 DD

I substituted the "+" with the "*" to use it in SQL Server which made
my
query look like this:

SELECT a1, b1, c1, d1
FROM   t1, t2, t3, t4
WHERE  t1.a =* t2.b
ANDt2.b =* t3.c
ANDt1.a2 = t4.d

But it fails with the error:

"The table 't1' is an inner member of an outer-join clause. This is
not
allowed if the table also participates in a regular join clause."

How to overcome this? Or is the query wrong?

Regards
Naveen


DISCLAIMER:
This message (including attachment if any) is confidential and may be
privileged. Before opening attachments please check them for viruses and
defects. MindTree Consulting Private Limited (MindTree) will not be
responsible for any viruses or defects or any forwarded attachments
emanating either from within MindTree or outside. If you have received
this message by mistake please notify the sender by return  e-mail and
delete this message from your system. Any unauthorized use or
dissemination of this message in whole or in part is strictly
prohibited.  Please note that e-mails are susceptible to change and
MindTree shall not be liable for any improper, untimely or incomplete
transmission.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net 
-- 
Author: Naveen Nahata
  INET: [EMAIL PROTECTED] 

Fat City Network Services-- 858-538-5051 http://www.fatcity.com 
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Darrell Landrum
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


RE: Outer join in SQL server - A very simple question

2003-06-25 Thread Adrian Roe
This does the same...

SELECT a1, b1, c1, d1
FROM
t1
left join t2 on t1.a=t2.b
left join t3 on t2.b=t3.c
left join t4 on t1.a2=t4.d

Ade

-Original Message-
Sent: 25 June 2003 12:55
To: Multiple recipients of list ORACLE-L


Please read "INSERT INTO t4 VALUES ('A', 'DD');" as "INSERT INTO t4 VALUES
('', 'DD');" in my previous mail.

Regards
Naveen

> -Original Message-
> From: Naveen Nahata 
> Sent: Wednesday, June 25, 2003 1:20 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Outer join in SQL server - A very simple question 
> 
> 
> Sorry for the SQL Server post, working on SQL Server for the 
> first time, and
> this list is my only resource as of now. I'm reading the SQL 
> Server join
> syntax and trying it myself. Meanwhile, If i can get some 
> expert help, it
> will be more than useful
> 
> I'm simplifying the problem with the help of these test tables.
> 
> CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
> CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
> CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
> CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));
> 
> INSERT INTO t1 VALUES ('A', 'AA', '');
> INSERT INTO t1 VALUES (null, '', '');
> 
> INSERT INTO t2 VALUES ('A', 'BB');
> 
> INSERT INTO t3 VALUES ('A', 'CC');
> 
> INSERT INTO t4 VALUES ('A', 'DD');
> 
> Table t1 refers to t2(through a) and t4(through a2) directly 
> and t2 refers to
> t3(through b). 
> 
> I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
> irrespective of whether the value is there in the other tables or
> not(outer-join of course)
> 
> I wrote this query in Oracle and it works
> 
> SQL> SELECT a1, b1, c1, d1
>   2  FROM   t1, t2, t3, t4
>   3  WHERE  t1.a = t2.b(+)
>   4  ANDt2.b = t3.c(+)
>   5  ANDt1.a2 = t4.d
>   6  /
> 
> A1 B1 C1 D1
> -- -- -- --
> AA BB CC DD
>  DD
> 
> I substituted the "+" with the "*" to use it in SQL Server 
> which made my
> query look like this:
> 
> SELECT a1, b1, c1, d1
> FROM   t1, t2, t3, t4
> WHERE  t1.a =* t2.b
> ANDt2.b =* t3.c
> ANDt1.a2 = t4.d
> 
> But it fails with the error:
> 
> "The table 't1' is an inner member of an outer-join clause. 
> This is not
> allowed if the table also participates in a regular join clause."
> 
> How to overcome this? Or is the query wrong?
> 
> Regards
> Naveen
> 
> 
> DISCLAIMER:
> This message (including attachment if any) is confidential 
> and may be privileged. Before opening attachments please 
> check them for viruses and defects. MindTree Consulting 
> Private Limited (MindTree) will not be responsible for any 
> viruses or defects or any forwarded attachments emanating 
> either from within MindTree or outside. If you have received 
> this message by mistake please notify the sender by return  
> e-mail and delete this message from your system. Any 
> unauthorized use or dissemination of this message in whole or 
> in part is strictly prohibited.  Please note that e-mails are 
> susceptible to change and MindTree shall not be liable for 
> any improper, untimely or incomplete transmission.
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: Naveen Nahata
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 


DISCLAIMER:
This message (including attachment if any) is confidential and may be
privileged. Before opening attachments please check them for viruses and
defects. MindTree Consulting Private Limited (MindTree) will not be
responsible for any viruses or defects or any forwarded attachments
emanating either from within MindTree or outside. If you have received this
message by mistake please notify the sender by return 

RE: Outer join in SQL server - A very simple question

2003-06-25 Thread Naveen Nahata
Please read "INSERT INTO t4 VALUES ('A', 'DD');" as "INSERT INTO t4 VALUES
('', 'DD');" in my previous mail.

Regards
Naveen

> -Original Message-
> From: Naveen Nahata 
> Sent: Wednesday, June 25, 2003 1:20 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Outer join in SQL server - A very simple question 
> 
> 
> Sorry for the SQL Server post, working on SQL Server for the 
> first time, and
> this list is my only resource as of now. I'm reading the SQL 
> Server join
> syntax and trying it myself. Meanwhile, If i can get some 
> expert help, it
> will be more than useful
> 
> I'm simplifying the problem with the help of these test tables.
> 
> CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
> CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
> CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
> CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));
> 
> INSERT INTO t1 VALUES ('A', 'AA', '');
> INSERT INTO t1 VALUES (null, '', '');
> 
> INSERT INTO t2 VALUES ('A', 'BB');
> 
> INSERT INTO t3 VALUES ('A', 'CC');
> 
> INSERT INTO t4 VALUES ('A', 'DD');
> 
> Table t1 refers to t2(through a) and t4(through a2) directly 
> and t2 refers to
> t3(through b). 
> 
> I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
> irrespective of whether the value is there in the other tables or
> not(outer-join of course)
> 
> I wrote this query in Oracle and it works
> 
> SQL> SELECT a1, b1, c1, d1
>   2  FROM   t1, t2, t3, t4
>   3  WHERE  t1.a = t2.b(+)
>   4  ANDt2.b = t3.c(+)
>   5  ANDt1.a2 = t4.d
>   6  /
> 
> A1 B1 C1 D1
> -- -- -- --
> AA BB CC DD
>  DD
> 
> I substituted the "+" with the "*" to use it in SQL Server 
> which made my
> query look like this:
> 
> SELECT a1, b1, c1, d1
> FROM   t1, t2, t3, t4
> WHERE  t1.a =* t2.b
> ANDt2.b =* t3.c
> ANDt1.a2 = t4.d
> 
> But it fails with the error:
> 
> "The table 't1' is an inner member of an outer-join clause. 
> This is not
> allowed if the table also participates in a regular join clause."
> 
> How to overcome this? Or is the query wrong?
> 
> Regards
> Naveen
> 
> 
> DISCLAIMER:
> This message (including attachment if any) is confidential 
> and may be privileged. Before opening attachments please 
> check them for viruses and defects. MindTree Consulting 
> Private Limited (MindTree) will not be responsible for any 
> viruses or defects or any forwarded attachments emanating 
> either from within MindTree or outside. If you have received 
> this message by mistake please notify the sender by return  
> e-mail and delete this message from your system. Any 
> unauthorized use or dissemination of this message in whole or 
> in part is strictly prohibited.  Please note that e-mails are 
> susceptible to change and MindTree shall not be liable for 
> any improper, untimely or incomplete transmission.
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: Naveen Nahata
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 


DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. 
Before opening attachments please check them for viruses and defects. MindTree 
Consulting Private Limited (MindTree) will not be responsible for any viruses or 
defects or any forwarded attachments emanating either from within MindTree or outside. 
If you have received this message by mistake please notify the sender by return  
e-mail and delete this message from your system. Any unauthorized use or dissemination 
of this message in whole or in part is strictly prohibited.  Please note that e-mails 
are susceptible to change and MindTree shall not be liable for any improper, untimely 
or incomplete transmission.
-- 
Please see the official ORACLE-L FAQ:

Outer join in SQL server - A very simple question

2003-06-25 Thread Naveen Nahata
Sorry for the SQL Server post, working on SQL Server for the first time, and
this list is my only resource as of now. I'm reading the SQL Server join
syntax and trying it myself. Meanwhile, If i can get some expert help, it
will be more than useful

I'm simplifying the problem with the help of these test tables.

CREATE TABLE t1(A VARCHAR(10), A1 VARCHAR(10), A2 VARCHAR(10));
CREATE TABLE t2(B VARCHAR(10), B1 VARCHAR(10));
CREATE TABLE t3(C VARCHAR(10), C1 VARCHAR(10));
CREATE TABLE t4(D VARCHAR(10), D1 VARCHAR(10));

INSERT INTO t1 VALUES ('A', 'AA', '');
INSERT INTO t1 VALUES (null, '', '');

INSERT INTO t2 VALUES ('A', 'BB');

INSERT INTO t3 VALUES ('A', 'CC');

INSERT INTO t4 VALUES ('A', 'DD');

Table t1 refers to t2(through a) and t4(through a2) directly and t2 refers to
t3(through b). 

I want to join t1 to t2, t3, t4 and retrieve all the rows inside t1
irrespective of whether the value is there in the other tables or
not(outer-join of course)

I wrote this query in Oracle and it works

SQL> SELECT a1, b1, c1, d1
  2  FROM   t1, t2, t3, t4
  3  WHERE  t1.a = t2.b(+)
  4  ANDt2.b = t3.c(+)
  5  ANDt1.a2 = t4.d
  6  /

A1 B1 C1 D1
-- -- -- --
AA BB CC DD
 DD

I substituted the "+" with the "*" to use it in SQL Server which made my
query look like this:

SELECT a1, b1, c1, d1
FROM   t1, t2, t3, t4
WHERE  t1.a =* t2.b
ANDt2.b =* t3.c
ANDt1.a2 = t4.d

But it fails with the error:

"The table 't1' is an inner member of an outer-join clause. This is not
allowed if the table also participates in a regular join clause."

How to overcome this? Or is the query wrong?

Regards
Naveen


DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. 
Before opening attachments please check them for viruses and defects. MindTree 
Consulting Private Limited (MindTree) will not be responsible for any viruses or 
defects or any forwarded attachments emanating either from within MindTree or outside. 
If you have received this message by mistake please notify the sender by return  
e-mail and delete this message from your system. Any unauthorized use or dissemination 
of this message in whole or in part is strictly prohibited.  Please note that e-mails 
are susceptible to change and MindTree shall not be liable for any improper, untimely 
or incomplete transmission.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Naveen Nahata
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).