sql >> Database teknologi >  >> RDS >> Oracle

behov for at gruppere poster baseret på matchende tilbageførsler

Jeg tror, ​​at dette kun er row_number() og aggregering:

select listagg(row_number, ',') within group (order by row_number) as row_numbers,
       loan_id, txn_entry_api_name, sum(txn_amt) as txn_amt,
       listagg(txn_entry_api_name, ',') within group (order by row_number) as txn_entry_api_name
from (select t.*,
             row_number() over (partition by loan_id, txn_entry_api_name, abs(txn_amt) order by row_number) as seqnum
      from t
     ) t
group by seqnum;



  1. Giv en bruger tilladelse til at ÆNDRE en funktion

  2. Sådan fungerer SESSION_CONTEXT() i SQL Server

  3. Hold mysql-forbindelsen åben

  4. TOAD mener &String som bindevariabel