count(distinct a.id) as count

以前还真没这么用过