select real_name as 姓名, a.phone as 手机号,id_card_no as 身份证号,id_card_type as 证件类型, a.address as 地址,f.num as 证件数量, f.card as 内含证件类型, c.name as 村小组名称, a.create_date as 注册时间 from typg_user as a left join sys_office as c on a.office_id=c.id left join ( select user_id, GROUP_CONCAT(DISTINCT CASE img_type WHEN 1 THEN '身份证' WHEN 2 THEN '户口本' WHEN 3 THEN '房屋照片' WHEN 4 THEN '土地证' WHEN 5 THEN '不动产证' WHEN 6 THEN '权属来源' WHEN 7 THEN '委托证明' WHEN 8 THEN '其他' ELSE '无' END ORDER BY img_type DESC SEPARATOR ',') AS card , count(*) as num from typg_certificate_image group by user_id ) as f on f.user_id=a.id order by a.office_id desc