472,353 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

group by works, order by gives error msg

Hi

I am a student, I am trying to figure this out. I am trying to run a select statement that is asking for customer#, date, and total price of each order. ensure results are in chronological order based upon order date.

When I run the following with just a group by clause, it works. If I add order by orderdate, I get an error message that states SQL Error: ORA-00979: not a GROUP BY expression. Why is the order by clause giving me a group by error message, but the group by works fine? How else would I get the results in chronological order?
Dec 1 '08 #1
3 3789
Pilgrim333
127 100+
Hi,

Could you post both of the queries you have tried?

Pilgrim.
Dec 1 '08 #2
Thanks for getting back to me, I can't believe I forgot to add the code! lol

what I am looking to do:
list customer#, date, and total price of each order. ensure results are in chronological order based upon order date

the following select statement with just a group by (which works) :

select customer#, order#, sum(quantity*retail) "total order"
from orders join orderitems using (order#)
join books using (isbn)
group by customer#, order#;

If I add order by orderdate; after the group by statement, I get this msg:

Error starting at line 5 in command:
select customer#, order#, sum(quantity*retail) "total order"
from orders join orderitems using (order#)
join books using (isbn)
group by customer#, order#
order by orderdate;
Error at Command Line:9 Column:9
Error report:
SQL Error: ORA-00979: not a GROUP BY expression
00979. 00000 - "not a GROUP BY expression"
*Cause:
*Action:

Should I be specifying orderdate in the select statement? (orderdate is in the orderitems table)
Dec 1 '08 #3
Pilgrim333
127 100+
Hi,

Indeed, you should specify the orderdate in de select statement and the group by statement.

Pilgrim.
Dec 3 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed...
10
by: Randell D. | last post by:
Folks, I have a SELECT that returns with multiple records - It works when I have a LIMIT clause but when I try to include a GROUP BY clause, the...
11
by: Experienced but Undocumented | last post by:
Hi, I have a table with three columns: datetime, subject, & author. (There are more columns, but these are the only relavent ones.) Some rows...
2
by: Experienced but Undocumented | last post by:
Here's another one; thanks so much to everyone who helped with my last problem. I can't upgrade mySQL but I figured out a way around it from your...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 ...
1
by: Tim Marshall | last post by:
A2003. I am getting this error message when I try to set a report's recordsource to an SQL statement or a saved querydef that uses sub-queries. ...
12
by: Bill Moran | last post by:
Hey all. I've hit an SQL problem that I'm a bit mystified by. I have two different questions regarding this problem: why? and how do I work...
2
by: denitram | last post by:
Hi, I have a table that has email, q1,q2 etc. I would like to select each email and the result should have each email listed once with the values...
5
by: Seb | last post by:
I want to count activity in a given month. I'm trying to do so with the linq code below however it reports: Error 1 'a' is inaccessible due to its...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.