Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select multiple (non-aggregate function) columns with GROUP BY

Dj SteeleApr 2 2019 — edited Apr 15 2019

Good Afternoon,  I am using PL/SQL Developer  and / or SQL Developer

Looking to Select some Columns but not have all of them in the Group By  ( The ones not in the Group By would be Non_Aggregate Columns )
I've Seen some examples where it look like people where accomplishing by doing some   Sub_Queries / Inner Joins to Accomplish, But I'm not exactly sure how to accomplish.

select c_job_piece as "Job Piece", c_Fund as "Fund", c_Account as "Account"

, c_Part_Code as "Part Code",t_OSF_FY as "Fiscal Year"   ----these are the  2 Columns I would like to exclude from the Group By

,

Sum( Case When  a_posting ......... End) as "Budget Amount"

,

Sum(Case When   c_Account_type.......End ) as "Encumbrance Amount"

,

Sum( Case When c_Tran_Type......End) as "Disbursement Amount"

,

Sum(Case When  c_Ref_Type ) as "Project Balance"

from fdep.detail_postings@fdep_bidb

where c_job_piece = :P375_JOBPIECE

group by c_job_piece, c_Fund --,c_Account       --,c_Part_Code ,t_OSF_FY

;

Thanks in Advance

DSteele41

This post has been answered by Dj Steele on Apr 15 2019
Jump to Answer
Comments
Post Details
Added on Apr 2 2019
5 comments
718 views