sneak_186
asked on
ORA-00979: not a GROUP BY expression
Any idea why i get the following error when i try to run this SQL query?
SQL> CREATE VIEW EventReportMonthly AS
2 SELECT
3 to_char(EStart,'YYYY MM') AS TYearMonth,
4 to_char(EStart - INTERVAL '6' MONTH,'MM') AS TFinMonth,
5 to_char(EStart - INTERVAL '6' MONTH,'YY') AS TFinYear,
6 count(*) AS TNumEvents,
7 sum(EAttendance) AS TTotalAttendance,
8 sum(EHireFee) AS TTotalHireFee
9 FROM EventR
10 GROUP BY to_char(EStart,'MM/YYYY')
11 ORDER BY to_char(EStart,'YYYY-MM');
to_char(EStart,'YYYY MM') AS TYearMonth,
*
ERROR at line 3:
ORA-00979: not a GROUP BY expression
SQL> CREATE VIEW EventReportMonthly AS
2 SELECT
3 to_char(EStart,'YYYY MM') AS TYearMonth,
4 to_char(EStart - INTERVAL '6' MONTH,'MM') AS TFinMonth,
5 to_char(EStart - INTERVAL '6' MONTH,'YY') AS TFinYear,
6 count(*) AS TNumEvents,
7 sum(EAttendance) AS TTotalAttendance,
8 sum(EHireFee) AS TTotalHireFee
9 FROM EventR
10 GROUP BY to_char(EStart,'MM/YYYY')
11 ORDER BY to_char(EStart,'YYYY-MM');
to_char(EStart,'YYYY MM') AS TYearMonth,
*
ERROR at line 3:
ORA-00979: not a GROUP BY expression
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes.
ASKER
Is that the standard format for a GROUB BY statement (ie you have to group by every attribute that isnt a total)?
Thanks again.
sneak_186