카테고리 없음

[SQL] 내부 select 문이 단일 그룹 함수로 등록되지 않음… "단일 그룹 그룹 함수가 아님"

행복을전해요 2021. 2. 1. 03:36
select   COUNT(*) as TOTAL_RXS, 
     SUM(rx_tx.brand_acquisition_cost) as TOTAL_COST,
          MAX(select 
                  SUM(tx_tp.balance_due_from_tp) as total_receivables
                        from eps2.tx_tp 
                                join eps2.rx_tx on rx_tx.id = tx_tp.rx_tx_id
                                      where 1=1
                                            AND (tx_tp.paid_status like '%PAID%' 
                                                  OR tx_tp.paid_status like '%PART%') ) as total_receivables
                                                  

집계 함수 로 마스킹하기 MAX()위해 for 추가 !total_receivables



출처
https://stackoverflow.com/questions/22049815