PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 12th, 2003, 12:13 PM
wolfespawn wolfespawn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 68 wolfespawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via AIM to wolfespawn
how do i write this query in ANSI?

ok. i am converting all my old non-ansi sql to sql code and ran across one that i didnt know how to convert in ansi....


select * from table a, table b where a.column(+)=b.column

converts to

select * from table b left outer join a ON (a.column=b.column)

cool..... but what do i do when i have a table that is the strong table on 1 outer join and then the weak table on another? i cant just declare it twice cuz i get table already defined...

how would i convert......

select * from table a, table b, table c
where a.column(+)=b.column AND
b.column(+)=c.column

?

Reply With Quote
  #2  
Old February 12th, 2003, 01:14 PM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 2,349 swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 4 Days 7 h 27 m 6 sec
Reputation Power: 390
Code:
select * 
  from c left join b on c.c = b.c
  left join a on b.c = a.c

Reply With Quote
  #3  
Old February 12th, 2003, 01:22 PM
wolfespawn wolfespawn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 68 wolfespawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via AIM to wolfespawn
fair enough... but i forgot to mention that tables A and table C
do not have a common column...

i didnt mean for it to appear that the "column" was the same column...

let me rewrite the query to be...

select * from table a, table b, table c
where a.column(+)=b.column AND
b.column2(+)=c.column2

Reply With Quote
  #4  
Old February 12th, 2003, 02:52 PM
swampBoogie swampBoogie is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: Paris Uppland
Posts: 2,349 swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level)swampBoogie User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 4 Days 7 h 27 m 6 sec
Reputation Power: 390
Why would that matter really?

Code:
select * 
  from c left join b on c.c1 = b.c1
  left join a on b.c2 = a.c2

Reply With Quote
  #5  
Old February 12th, 2003, 02:54 PM
wolfespawn wolfespawn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 68 wolfespawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via AIM to wolfespawn
i guess that looked to me like i would be LEFT JOINING C to A when there was no relation

i guess thats right.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > how do i write this query in ANSI?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap