column

I have data stored in db as row wise. that data i have to show in column wise is that possible if so please let me know 

data stored in database like below 

Contact ID 

Contact Limit  

AED (000) 

Contact Outstanding 

(AED’000) 

Value of Extension Sought  

AED (000) 

Capital Amount 

AED (000) 

Interest Payment Due 

(AED’000) 

Current Due Date 

Days to be Extended 

New Maturity Date  

From CrP 

=Contract Limit 

= Value of Full Contract - Outstanding 

 

=Value of Extension Sought 

= capital amount 

= Interest Payment  

=Current Maturity Date of Payment being extended 

=Number of days extension sought (B) 

=New Extended Maturity Date 

 

 

 

 

 

 

 

 

 

Total 

 

100,000 

5,555 

 

1,192 

 

 

 

here is the table, i have to show that data like this.. some selected rows data have to show in table as column wise 

can anyone suggest me on this

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Yes, I have worked on such a use case long back. We created a view by joining on the same table multiple times. The first join was on the column that we can group data on and second join on another column for which we want to create a particular column. It might be more typical if you are using record as data source. Giving an example below:

    SELECT DISTINCT
    T1.REQUEST_ID as REQUEST_ID,
    T2.VALUE as CONTRACT_NO,
    T3.VALUE as CONTRACT_LIMIT
    FROM
    table T1
    JOIN table T2
    ON (T1.REQUEST_ID=T2.REQUEST_ID and T2.FIELD_NAME="Contact No")
    JOIN table T3
    ON (T1.REQUEST_ID=T3.REQUEST_ID and T3.FIELD_NAME="Contact Limit")

    You might have to group but I believe the "DISTINCT" keyword should do the trick.

Reply
  • 0
    Certified Lead Developer

    Yes, I have worked on such a use case long back. We created a view by joining on the same table multiple times. The first join was on the column that we can group data on and second join on another column for which we want to create a particular column. It might be more typical if you are using record as data source. Giving an example below:

    SELECT DISTINCT
    T1.REQUEST_ID as REQUEST_ID,
    T2.VALUE as CONTRACT_NO,
    T3.VALUE as CONTRACT_LIMIT
    FROM
    table T1
    JOIN table T2
    ON (T1.REQUEST_ID=T2.REQUEST_ID and T2.FIELD_NAME="Contact No")
    JOIN table T3
    ON (T1.REQUEST_ID=T3.REQUEST_ID and T3.FIELD_NAME="Contact Limit")

    You might have to group but I believe the "DISTINCT" keyword should do the trick.

Children