Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2012, 10:58 AM
Registered User
 
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default query for fetching parent/child records in a single row

Hi,

I want to fetch both the parent and child records in a single row .
PFB the query for the same.
With this query iam able to get the record in a single row, but in my case
the dept and year are optional, so there will not be any data in table ,
so if i fetch , it should retreive as null for that particular field.

select one.name college, two.name student, three.name dept , four.name year from test4 one, test4 two, test4 three, test4 four where two.parentid = one.id and three.parentid = two.id and four.parentid = three.id
I tried using or/join clause, but did not work.Please suggest.


Regards,
Subha





Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving a single value from a single column in a single row? Ron Howerton LINQ 2 May 17th, 2011 08:46 AM
fetching records from website avats General .NET 0 November 3rd, 2005 03:36 PM
Parent - Child Combo babloo81 JSP Basics 0 April 27th, 2005 01:46 PM
Parent and Child Records in Same Table owain SQL Language 12 October 27th, 2004 10:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.