显示月份和每个月收到的报价。 我使用了此查询,但最终输出与我的输出不同。
select distinct To_char(QDate,'Month') as Month,count(QuotationId)as QuotationCount
from Quotation group by Qdate
答案 0 :(得分:1)
您需要在To_char(QDate,'Month')
子句中添加group by
select To_char(QDate,'Month') as Month,count(QuotationId)as QuotationCount
from Quotation group by To_char(QDate,'Month')
答案 1 :(得分:0)
如果您希望按时间顺序排列数据,则:
select to_char(QDate, 'Month') as Month, count(*) as QuotationCount
from Quotation
group by to_char(QDate, 'Month')
order by to_char(QDate, 'MM);
在某些数据库中,可以使用SELECT
中定义的列别名:
group by Month