I am having a table which will have 3 or more rows for each tran_ref column and each row will have amount as well as tran_id follwing is my input table
tran_ref | tran_id | amount
T1 |01. | 9
T1 |02. | -8
T1 |03 | -1
T2 |01. | 5
T2 |02. | -4
T2 |03 | -1
T2 |03 | -1
I want one row for each tran_ref in some other table as
tran_ref | amount_01 | amount_02| amount_03 | count_of_ref_rows
T1 | 9 | -8 | -1. | 3
T2 | 5 | -4 | -2. | 4
I tried with join but didn't worked as expected Thanks :)
Updated data
If this is the table
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