写每个月购物一次和新老会员数

用sql 查询 工作中遇到的问题,写每个月购物一次和新老会员数。。。。。。。。。。。。。。。。。。。。。。。。

 select userid
from 表 where month(日期) between 1 and 12
 group by userid  
having(count(distinct month(日期)))=12