简体   繁体   中英

Take data from multiple rows into single row

INFLOW_DESC   INFLOW_AMT   OUTFLOW_DESC   OUTFLOW_AMT
=====================================================
  LOAN           13         
---------------------------------------------------
                            DEPOSIT          20
---------------------------------------------------

Want to show like

INFLOW_DESC   INFLOW_AMT   OUTFLOW_DESC   OUTFLOW_AMT
=====================================================
  LOAN           13           DEPOSIT         20
---------------------------------------------------

You can use aggregation:

select max(INFLOW_DESC) as INFLOW_DESC,
       max(INFLOW_AMT) as INFLOW_AMT,
       max(OUTFLOW_DESC) as OUTFLOW_DESC,
       max(OUTFLOW_AMT) as OUTFLOW_AMT
from t;

This problem usually occurs because of a malformed GROUP BY . If this data is generated by another query, then ask a new question with a perhaps simplified version of your query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM