SELECT
    count( 1 ) AS "num1",
    count( DATE_FORMAT( b.create_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) OR NULL ) AS "num2",
    count( PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( b.create_date, '%Y%m' ) ) = 1 ) AS "num3" 
FROM
    hz_user a
    LEFT JOIN hz_user b ON a.usernum = b.salesmannum 
WHERE
    a.salesmanign = '1';

查询某个用户所有新增的用户,本月新增用户,上个月新增的用户

posted on 2018-12-05 18:25  song.yan  阅读(372)  评论(0编辑  收藏  举报