A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
Displaying 2 tables data in a single row
Joined: Oct 12, 2006
Aug 30, 2007 06:48:00
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
Joined: Dec 20, 2006
Aug 30, 2007 07:29:00
(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.
OCUP UML fundamental and ITIL foundation
I agree. Here's the link:
subject: Displaying 2 tables data in a single row
DB2 700 and 701 - Test Sample
need help in pivot
Optimizing a database
db2 - 703 certification
Inner and Outer Joins
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015