[askdba] Re: SQL Doubt

  • From: "Justin Cave (DDBC)" <jcave@xxxxxxxxxxx>
  • To: <askdba@xxxxxxxxxxxxx>
  • Date: Wed, 20 Oct 2004 00:32:22 -0600

This looks like a relatively standard pivot query.  For an example that
walks through how to build this sort of query, you can look at this
discussion http://www.ddbcinc.com/askddbc/topic.asp?TOPIC_ID=3D676

How do you differentiate who is the first borrower and who is the second
borrower?  Same question for guarantors...

Justin Cave  <jcave@xxxxxxxxxxx>
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

-----Original Message-----
From: askdba-bounce@xxxxxxxxxxxxx [mailto:askdba-bounce@xxxxxxxxxxxxx]
On Behalf Of Mudhalvan, Moovarkku
Sent: Tuesday, October 19, 2004 2:08 AM
To: askdba@xxxxxxxxxxxxx
Subject: [askdba] SQL Doubt

Dear Friends,
        We have two tables loan,entity_loan.=3D20

        Loan -> Loan_id
        Entity_loan -> Loan_id,Entity_id,Entity_type

Values in the Loan table
Loan_ID
L1
L2
L3

Values in Entity_loan Table
Loan_ID         Entity_ID       Entity_Type
L1              E1              B
L1              E1              G
L1              E2              B
L1              E3              G


I need the output like=3D20

Loan_ID         Borrower1       Borrwer2        Guar1           Guar2
L1              E1              E2              E1              E3

Please if any one can have any idea let me know.

Thanks in Advance
Mudhalvan M.M


Other related posts: