[英]…oracle group by syntax for beginners
請問這是什么問題?
select inst.id
, inst.type as "TypeOfInstall"
, count(inst.id) as "NoOfInstall"
from dm_bsl_ho.installment inst
group by inst.type
不允許將單個功能與組功能一起使用。 就像混合count
與單行功能一樣。
您應該包括group by
功能group by
:
select inst.type as "TypeOfInstall"
, count(inst.id) as "NoOfInstall"
from dm_bsl_ho.installment inst
GROUP BY inst.type;
當您在大多數RDBMS中執行GROUP BY
時,您的選擇僅限於以下兩件事:
GROUP BY
提到的列-在您的情況下,這是inst.type
count(inst.id)
但是,頂部的inst.id
都不是其中之一。 您需要刪除它以使該語句起作用:
SELECT
type as "TypeOfInstall"
, COUNT(id) as "NoOfInstall"
FROM dm_bsl_ho.installment
GROUP BY type
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.