Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Oracle

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-02 : 07:58:42
Joiada writes "SQL Select Statement Using Multiple Tables in Oracle"

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2003-03-02 : 17:05:03
Idenitcal to select using multiple tables in T-SQL.

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

etc....


--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-27 : 18:13:02
quote:

Idenitcal to select using multiple tables in T-SQL.

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

etc....



Isn't that the T-SQL syntax only? Should Joiada be using the JOIN syntax so that the code can port to other systems that use SQL 92?

Tara

Edited by - tduggan on 03/27/2003 18:13:40
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-03-27 : 21:45:15
No, that's standard WHERE clause inner join syntax. The *= and =* is T-SQL specific and is considered obsolete. Oracle did not support the ANSI LEFT/RIGHT/INNER JOIN syntax until version 9 (!) and I'm sure a bunch of Oracle diehards are upset that it does now.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-28 : 12:25:30
quote:

No, that's standard WHERE clause inner join syntax. The *= and =* is T-SQL specific and is considered obsolete. Oracle did not support the ANSI LEFT/RIGHT/INNER JOIN syntax until version 9 (!) and I'm sure a bunch of Oracle diehards are upset that it does now.




Thanks for the clarification, robvolk! I wasn't sure anyway, so that's why I asked.

Tara
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-03-28 : 12:47:53
Just curious -- I know nothing about Oracle.

If *= and *= are T-SQL, and Oracle just now supported the ANSI join syntax, what was the old Oracle syntax for outer joins??

- Jeff
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-03-29 : 08:24:54
Something like this:

SELECT * FROM A, B WHERE A.ID(+)=B.ID

And for the life of me, I can't remember if that's a left or right join. All I know is that it was completely counterintuitive, and you could simply change the order of A and B in the FROM clause and/or in the WHERE clause and you'd get TOTALLY different results and not always realize it. And up until Oracle 8 (they say 7 would optimize, I don't believe it) this syntax wouldn't optimize in any way...it would run exactly as you ordered it, like using the FORCE ORDER clause in T-SQL. So changing the order of tables in the FROM clause can change results AND execution. And remember, Oracle is "better" than SQL Server.

Go to Top of Page
   

- Advertisement -