题目链接:点击打开链接
题目大意:略。
解题思路:略。
AC 代码
SELECTa.visited_on, sum( b.amount ) ASamount, round(sum( b.amount ) /7, 2 ) ASaverage_amountFROM ( SELECTDISTINCTvisited_onFROMcustomer ) aJOINcustomerbONdatediff( a.visited_on, b.visited_on ) BETWEEN0AND6WHEREa.visited_on>= (SELECTmin( visited_on ) FROMcustomer ) +6GROUPBYa.visited_on