Group By and (SELECT) , oracle newbie question [message #18810] |
Fri, 15 February 2002 01:10 |
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 |
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.
|
|
|