View previous topic :: View next topic |
Author |
Message |
priyam Beginner
Joined: 05 Jul 2006 Posts: 16 Topics: 12
|
Posted: Tue Nov 21, 2006 5:50 am Post subject: Need a SQL Query to join the result of two queries |
|
|
Need a SQL Query:
I have three input tables. CUST_DETAILS,EUITY_DETAIL and BOND_DETAIL.
Input:
CUST_DETAILS:
ACCT NAME
511 PRIYA
512 MANOJI
EQUITY_DETAIL
ID ACCT DATE CIP
610 511 11/03/2006 IBM
610 511 11/04/2006 MFST
611 512 11/03/2006 BBY
611 512 11/04/2006 CSCO
BOND_DETAIL
ID ACCT DATE CIP
610 511 11/03/2006 CDDE1
610 511 11/04/2006 CDDE2
611 512 11/03/2006 CDDE3
611 512 11/04/2006 CDDE4
My Output Should be:
ACCT DATE CIP
511 11/03/2006 IBM
511 11/04/2006 MFST
511 11/03/2006 CDDE1
511 11/04/2006 CDDE2
512 11/03/2006 BBY
512 11/04/2006 CSCO
512 11/03/2006 CDDE3
512 11/04/2006 CDDE4
When i use Union i got the output like
ACCT DATE CIP
511 11/03/2006 IBM
511 11/03/2006 CDDE1
511 11/04/2006 MFST
511 11/04/2006 CDDE2
512 11/03/2006 BBY
512 11/03/2006 CDDE3
512 11/04/2006 CSCO
512 11/04/2006 CDDE4
It displays first with the date 11/03/2006 for the ACCT 511 from both the tables and then for 11/04/2006.
Can anyone help me on this?
[/b] |
|
Back to top |
|
 |
bauer Intermediate
Joined: 10 Oct 2003 Posts: 317 Topics: 50 Location: Germany
|
Posted: Tue Nov 21, 2006 6:27 am Post subject: |
|
|
priyam,
Question 1:
are you talking about a sort on column acct , date and for rows with equal acct ,date first the rows from table EQUITY_DETAIL and second rows from table BOND_DETAIL should be in the result set? Is this correct?
Question 2:
are any fields required from table CUST_DETAILS ?
regards,
bauer |
|
Back to top |
|
 |
|
|