如何根据第一周、第二周、第三周和第四周进行计数

how to take the count based on first week and second and third week and fourth week

我有一个 table 名称(任务),这里我想取 count 比如有多少注册发生在首先,有多少注册发生在其次如何如何做到这一点,我是 mysql 和 PHP 的新人。

id              name                   t_created_on
1               Kani                   2017-03-03 12:45:18
2               yuvi                   2017-03-04 12:45:18  
3               Mahesh                 2017-03-11 12:45:18

Here i am using this format date("Y-m-d h:i:s")

根据我的数据库,第一周是第 2 周注册,第二周是第 1 周。

Expected results:

第一周计数:2

第二周计数:1

SELECT WEEK(t_created_on) as week, count(*) as count
FROM my_table
GROUP BY WEEK(t_created_on)
ORDER BY WEEK(t_created_on);

1.

SELECT count(*) as records FROM tbl
WHERE t_created_on >= curdate() - INTERVAL DAYOFWEEK(curdate())+6 DAY
AND t_created_on < curdate() - INTERVAL DAYOFWEEK(curdate())-1 DAY

2.

SELECT count(*) as weekrecord  FROM tb1
WHERE 
WEEK (date) = WEEK( current_date ) -1 AND YEAR( date) = YEAR( current_date );

注:WEEK(current_date)-1:数字表示周数。

 SELECT count(*) as weekrecord, MONTH(current_date) as monthwise
 FROM tb1
    WHERE 
        WEEK (date) = WEEK( current_date ) -1
        AND YEAR( date) = YEAR( current_date );