按照周或者月统计活跃数: 周: SELECT week, COUNT(DISTINCT pin), business_type FROM ( SELECT DISTINCT user_log_acct AS pin,weekofyear(dt) AS week , CASE locate('bdp', url_domain) WHEN 0 THEN 'pinpiao' ELSE 'caixiao' END AS business_type FROM gdm.gdm_online_log WHER
mssql函数 IF EXISTS ( SELECT 1 FROM sysobjects WHERE name = 'fn_GetWeekDate') DROP FUNCTION fn_GetWeekDate GO CREATE function [dbo].fn_GetWeekDate( @Year int, --年份 @Week int --第几周 ) RETURNS @Table TABLE(beginTime datetime,endTime datetime) AS BEGIN dec
--按mySql语法统计按周,月,季,年.income为合计的价格字段,createDate为交易时间. select sum(income)as revenue,week(createDate) as week,month(createDate) as month, quarter(createDate)as quarter,year(createDate)as year from employee ' group by week(createDate),month(createDate),q
let pickDate = moment(this.searchForm.date); let firstDay = pickDate.day(0).format('YYYYMMDD');//上周天 let lastDay = pickDate.day(7).format('YYYYMMDD');//周天 let previousDate = moment(this.searchForm.date).subtract(1, "weeks").format("YYYY-MM-