PL/SQL (MOSC)

MOSC Banner

How to "group by" the result of a query with sub-queries

edited Nov 2, 2016 1:30PM in PL/SQL (MOSC) 2 commentsAnswered ✓

Hello,

I'm a bit struggling with this SQL statement and the "Group By" function:

the following SQL works (no group by):

-- Main Query:

select TO_CHAR(AST.CREATED, 'YYYY MM') as "Month Created",

    

-- Subquery 1:

      (select COUNT(AST1.ROW_ID)

          from SIEBEL.S_ASSET AST1

         where AST1.ROW_ID = AST.ROW_ID

          AND AST1.CREATED_BY = '1-1P211C') as "Bonus given by EIM",

-- Subquery 2:    

       (select COUNT(AST2.ROW_ID)

          from SIEBEL.S_ASSET AST2

         where AST2.ROW_ID = AST.ROW_ID

           AND AST2.CREATED_BY = '0-1') as "Bonus given by SADMIN"

  from SIEBEL.S_ASSET AST

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