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';
查询某个用户所有新增的用户,本月新增用户,上个月新增的用户