Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My Table name is books having the attributes:

bookid
title
author
publisher_name
publisher_address
no_of_copies
cost
subject
publishing_date
isbn

My question is:

List the books order by the year of publishing (oldest book first) categorized by subject.

My query is:

SQL
select * from books group by subject having order by publishing_date;


What is wrong here?

I get : ORA-00936: missing expression
Posted

select * from books group by subject having order by publishing_date;

Remove the having.

In addition, you cannot hae * when you are using group by.

Try select subject, publishing_date from books group by subject order by publishing_date;
 
Share this answer
 
v4
Comments
SubhamSoni123 27-Jan-14 11:58am    
I get this: ORA-00979: not a GROUP BY expression
Abhinav S 27-Jan-14 12:00pm    
Try now.
SubhamSoni123 27-Jan-14 12:03pm    
Same error...
GROUP BY implies that you want to aggregate multiple rows from the table into a single row for every SUBJECT value. If that is your goal, you need to specify an aggregate function on the columns that you are not grouping by.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900