Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying 2 tables data in a single row

 
vamsikiran mallampalli
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2596
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic