SQL Language (MOSC)

MOSC Banner

How to Group By but still retain all columns in result set?

edited Feb 12, 2018 4:00AM in SQL Language (MOSC) 4 commentsAnswered

Given a table with such as this:

EMPLID  SDN         EFFDT      AMOUNT  ELIG  PROCESS  THISCD  THATCD  PAS  ORDNUM GROUP

80076   2016FC0347  5/1/2016   150     Y     Y        AA      BB      N    71966  ZED

80076   2016FC0347  5/1/2016   25.67   Y     Y        AA      BB      N    71966  ZED

80076   2016FC0347  5/1/2016   200     Y     Y        AA      BB      N    71966  ZED

80076   2016FC0347  6/9/2016   30.50   Y     N        XX      BB      N    71966  ZED

80076   2016FC0347  6/9/2016   170.50  Y     N        XX      BB      N    71966  ZED

We want a view that would Group By EMPLID, SDN, EFFDT and Sum the AMOUNTs. However, retain ALL columns in the result set(yes they will be the same values).

-- DESIRED OUTPUT --

80076   2016FC0347  5/1/2016   375.67  Y     Y        AA      BB      N    71966  ZED

80076   2016FC0347  6/9/2016   201     Y     N        XX      BB      N    71966  ZED

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center