Home » SQL & PL/SQL » SQL & PL/SQL » Group By and (SELECT) , oracle newbie question
Group By and (SELECT) , oracle newbie question [message #18810] Fri, 15 February 2002 01:10 Go to next message
Elias
Messages: 4
Registered: February 2002
Junior Member
i have this query:

select accountid, cost, duration, calldate, ani, dialed from switch_transaction where accountid in (select customer_number from customer where dealer_number='166') and ( (to_date('MMDDYY', calldate) > to_date('1-01-2000','MM-DD-YYYY') ) AND ( to_date('MMDDYY', calldate) < to_date('1-01-2002','MM-DD-YYYY') ) ) group by accountid

and i get this:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[[Microsoft]][[ODBC driver for Oracle]][[Oracle]]ORA-00979: not a GROUP BY expression

why this error ?

i mean i can't see what's wrong with my SQL statment!
the accountid and the customer_number are of the same format in both tables.

can you also reply to elias_at_hostrix.com
Re: Group By and (SELECT) , oracle newbie question [message #18813 is a reply to message #18810] Fri, 15 February 2002 01:44 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
change your query ...you are grouping by accountid but selecting these "cost, duration, calldate, ani, dialed "

-----------------------------------------------
ORA-00979 not a GROUP BY expression
-----------------------------------------------
Cause: The GROUP BY clause does not contain all the expressions in the SELECT clause. SELECT expressions that are not included in a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must be listed in the GROUP BY clause.

Action: Include in the GROUP BY clause all SELECT expressions that are not group function arguments.
Previous Topic: what r the steps we have to follow after sucessfully compiled the explicit cursor
Next Topic: how to delete the records from master table when it has child relationships
Goto Forum:
  


Current Time: Wed Apr 24 18:02:53 CDT 2024