计算两个数据相除 select (select sum(a) from xx)/(select sum(b) from xx) from dual; 格式化为两位小数decimal=2 select convert(4545.1366,decimal); 仅供参考,你自己写出来的印象会深一点。 不提供完整sql
这个是回头人数 select a.fdate as actfdate, b.fdate as backfdate, count(a.uid) as backCnt from (SELECT fdate, uid from table where fdate >= startA and fdate < endA) as a, (SELECT fdate, uid from table where fdate >= startB and fdate < endB) as b where a.uid = b.uid and a.fdate < b. fdate group by actfdate, backfdate这是当天活跃 select fdate, count(uid) as actCnt from table where fdate >= startA and fdate < endA group by fdate这两个表连接 就求出回头率了还有表结构, uid 为什么用string ?一般不是int 或者bigint吗? 然后 启动时长, 一天才 8w多秒, 为什么用bigint, 启动次数也是, 还有日期, 为什么用string? 不用int?
select (select sum(a) from xx)/(select sum(b) from xx) from dual;
格式化为两位小数decimal=2
select convert(4545.1366,decimal);
仅供参考,你自己写出来的印象会深一点。
不提供完整sql
这个是回头人数
select a.fdate as actfdate, b.fdate as backfdate, count(a.uid) as backCnt from
(SELECT fdate, uid from table where fdate >= startA and fdate < endA) as a,
(SELECT fdate, uid from table where fdate >= startB and fdate < endB) as b
where a.uid = b.uid and a.fdate < b. fdate group by actfdate, backfdate这是当天活跃
select fdate, count(uid) as actCnt from table where fdate >= startA and fdate < endA group by fdate这两个表连接 就求出回头率了还有表结构, uid 为什么用string ?一般不是int 或者bigint吗? 然后 启动时长, 一天才 8w多秒, 为什么用bigint, 启动次数也是, 还有日期, 为什么用string? 不用int?