sum(当-condition-然后计数else 0结束的情况)
SELECt SUM(case when $P{oneDayAgo} <= datetime then count else 0 end) as 'today', SUM(case when $P{oneWeekAgo} <= datetime then count else 0 end) as 'thisweek', SUM(count) as 'thismonth'FROM statisticsWHERe name = "test" AND $P{oneMonthAgo} <= datetime AND datetime <= $P{now}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)