0
组我有下面的查询,以显示我计数单的日子,如20160101.甲骨文日,月和年
如何修改下面的查询,以便它可以按日期每个国家组,月和年?
请注意目前正在使用Oracle数据库。
很多预先感谢。
Select count(1), country_of_sale, substr(datefield,1,8) AS datefield1
from table
where country_of_sale IN (‘USA’,’EUROPE’,’ASIA’)
group by country_of_sale, substr(datefield,1,8)
order by substr(datefield,1,8)
请显示表格定义,样本表格数据和预期输出。 – OldProgrammer
你的意思是你要求每个月的所有日期***和***每个月的小计***和***每年的小计?像'ROLLUP'一样?可以肯定的是,对您来说最好的选择是包含一些示例数据和您期望从示例数据中获得的结果。 – MatBailie