Oracle 10g查询 - 按顺序分组并按顺序排列 [英] Oracle 10g query - group by and order by together
本文介绍了Oracle 10g查询 - 按顺序分组并按顺序排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的桌子名称是具有以下属性的书籍:
bookid
title
author
publisher_name
publisher_address
no_of_copies
费用
主题
publishing_date
isbn
我的问题是:
按出版年份列出图书订单(最早的书籍)按主题分类。
我的查询是:
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:
select * from books group by subject having order by publishing_date;
这里有什么问题?
我得到:ORA-00936:缺少表达式
What is wrong here?
I get : ORA-00936: missing expression
推荐答案
select * from books group by subject having order by publishing_date;
删除
。
另外,当您使用分组
时,你不能*。
试试按照主题顺序从books group中选择主题,publishing_date由publishing_date;
GROUP BY意味着您要将表中的多行聚合为一个每个SUBJECT值的单行。如果这是您的目标,则需要在未分组的列上指定聚合函数。
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.
这篇关于Oracle 10g查询 - 按顺序分组并按顺序排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文