select count(*) from (select * from order group by userid) temp ; // order:订单表,userid:用户id,temp:别名(任意起)