Life doesn't get easier or more forgiving; we get stronger and more resilient.
生活從未變得更加輕松或寬容,是我們在一點一點變強、變堅韌。———— Steve Maraboli
今天在做一個銷售業(yè)績的排行功能,統(tǒng)計公司銷售在本月及當天的業(yè)績金額并進行排行。 例:數(shù)據(jù)表中有以下幾個關鍵字段:用戶名username,金額P,簽單時間T ….銷售每簽一單就錄入一條記錄。 SQL語句: $today = strtotime(“today”); ? ?//今天零點時間戳 SELECT *,SUM(P) AS total_P_month,SUM(CASE WHEN T>$today THEN P ELSE 0 END) AS total_P_today FROM table WHERE T&g...