select distinct count(*) AS count, VL_GUESTNAME from T_VISIT_LOG where CONVERT(varchar(10),VL_CHECKINTIME,120)>'2015-09-30' GROUP BY VL_GUESTNAME Order by count DESC
筛选出最近一年访客及访问次数
select distinct top 6 count(*) AS count, GUESTNAME from EV_VISIT_LOG where CONVERT(varchar(10),CHECKINTIME,120)>'2015-09-30' GROUP BY GUESTNAME Order by count DESC
列出访问次数最多的前六名访客