I have a table which will have 3 or more rows for each tran_ref
column value, and each row will have amount as well as tran_id
.
The following is my input table - I want one row for each tran_ref
in some other table as
tran_ref | tran_id | amount | Currency | Date
---------+---------+--------+----------+-----------
T1 | 01 | 9. | USD | 02-09-2020
T1 | 02 | -8. | INR | 03-09-2020
T1 | 03 | -1. | INR | 03-09-2020
Updated result needed
tran_ref | amount_01 | amount_02 | amount_03 | count | cur1 | cur23 | date1
---------+-----------+-----------+-----------+-------+------+-------+------
T1 | 9 | -8 | -1 | 3 | USD | INR | 02-092020
Please note currency1
should be from tran_id = 1
, currency23
from tranId23
and date should be only from tran_id 1