rpsc.net
当前位置:首页 >> orAClE sql报表统计,怎么按订单类别,分组显示订... >>

orAClE sql报表统计,怎么按订单类别,分组显示订...

SELECT ord.ORDER_TYPE as 订单类型, COUNT(ord.ORDER_ID) as 订单总数, orde.succCount as 交易成功订单总数 FROM ORDER ord LEFT JOIN ( SELECT ORDER_TYPE, COUNT(ORDER_ID) AS succCount FROM ORDER WHERE STATUS_ID = 'ORDER_SUCCESS' GROU...

再套一层: select COUNT(1) from (select a.col1 from (select '11' col1 from dual union all select '22' from dual union all select '33' from dual union all select '11' from dual union all select '33' from dual union all select '2...

如果只是统计合计分数的话可以参考如下: select P.Area,P.Quality,P.Type,Sum(P.Score) from Prod as P group by P.Area,P.Quality,P.Type;其中,对应关系: Prod---历史记录表 Area---产地 Quality---品质 Type---种类 Score---打分

select 产品类别,avg(消费时间) from table group by 产品类别

可以通过district来取出字段,之后通过count计算总数量。 sql:select count(district id) from tablename; 如果id字段没有空值的话,可以通过count统计字段的总数量(字段内容可能重复)。 sql:select count(id) from tablename;

条件 同样的姓名和客户号,有多个订单,支付的金额不等于退款的金额 执行结果如下 姓名 客户号 差异金额 JACK 001 40 执行语句参考 create table test_001 as select 'JACK' as 姓名 ,'001' AS 客户号 ,'10000' AS 订单号 ,'支付' AS 类型 ,100 ...

不知道你什 么数据库,给出sqlserver和oracle的 select 星期,字母from(select rank() over(partition by 星期 order by 字母 desc) id,*from 表) t1where id=1 或者 select 星期,max(字母)from 表group by 星期

可以通过count函数来实现。 sqlOne:select * from tablename1 where id>5;此语句查询出来多条记录,之后看做一个新的表。 sqlTwo:select conut(*) from (select * from tablename1 where id>5) as tablename2;此语句即可查询出来统计的记录条...

你createtime什么类型的字段啊 如果是date型 select to_char(createtime,'yyyymm'),sum(totacaccount) from 表名where to_char(createtime,'yyyy')=to_char(sysdate,'yyyy')group by to_char(createtime,'yyyymm') 如果是字符型 select substr(c...

select T.total, (A.ssbm || '(' || to_char(A.cnt_ssbm) || ')') as ssbm, T.id from T,(select substr(ssbm,1,2) as ssbm, count(ssbm) as cnt_ssbm from T group by substr(ssbm,1,2)) A where A.ssbm = substr(T.ssbm,1,2); 这样写再试一下。

网站首页 | 网站地图
All rights reserved Powered by www.rpsc.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com