File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Oracle/OAS and the fly likes Displaying 2 tables data in a single row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Displaying 2 tables data in a single row" Watch "Displaying 2 tables data in a single row" New topic
Author

Displaying 2 tables data in a single row

vamsikiran mallampalli
Greenhorn

Joined: Oct 12, 2006
Posts: 18
I have 2 tables,t1 (parent table)and t2(child).
In t1 i have 10 columns and t2 has 4 columns.

In t1 and t2 there is a common column x.
For each record of this common column x -- (Eg:x=100)
t1 has 1 row data
t2 has 24 rows data.

The requirement is

Display T1's 1 row data and T2's 24 rows data as a single row.

THis should be done using a oracle query only.Later i need to display all these columns as a single row in front end.

I have used joins to join them but unable to display them as a single row data..
Any ideas?Please help me as early as possible as this is an urgent requirement.

Thanks in advanc
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2476
    
    7

(almost) Impossible in a plain sql query.

You would need to know upfront that t2 has exactly 24 rows for each t1 record,
then join in table t2 24 times,
meanwhile taking care that you don't join the same t2 record more than once.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
 
 
subject: Displaying 2 tables data in a single row
 
Similar Threads
Optimizing a database
Inner and Outer Joins
db2 - 703 certification
DB2 700 and 701 - Test Sample
need help in pivot