MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Query for Parent - Child relationship in the same table.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu May 20, 2004 4:40 am    Post subject: Reply with quote

Ravi,

what exactly do you mean single query? Do you want the results without using join?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu May 20, 2004 4:55 am    Post subject: Reply with quote

Ravi,

Hmm wouldn't that be a recursive sql? And DB2 is not yet there for recursive sql's. However you can get the results using User defined functions. I am not sure if SYBASE supports recursive sql

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu May 20, 2004 6:16 am    Post subject: Reply with quote

Ravi,

Check this link for sybase

http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.7

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 317
Topics: 50
Location: Germany

PostPosted: Mon May 24, 2004 11:21 am    Post subject: Reply with quote

Ravi,

1) i agree with kolusu, recursive sql is not possible with DB2 / OS390 / Version 7.2
2) if the maximum number of levels is fix and not to large, you should try a solution with left outer joins to join the next level if levle available
3) recursive sql: Check the WITH clause; i cann't remember the exactly syntax using other sql than OS/390


Your problem looks like a parts list problem ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group