SELECT     'A24111312514226218038' as NO, dbo.AlumUsers.Mobile as Phone,CASE WHEN dbo.AttendMeets.IsAudit ='Y' THEN '1' ELSE (CASE WHEN dbo.AttendMeets.IsAudit ='D' THEN '2' ELSE '0' END) END  as IsAudit, CASE WHEN dbo.AttendMeets.IsCost ='Y' THEN '1' ELSE '0' END as IsCost, dbo.AttendMeets.CostTime
FROM         dbo.AlumUsers RIGHT OUTER JOIN
                      dbo.AttendMeets ON dbo.AlumUsers.Id = dbo.AttendMeets.AlumnusNo LEFT OUTER JOIN
                      dbo.AnnualMeetings ON dbo.AttendMeets.AMNo = dbo.AnnualMeetings.Id
WHERE      dbo.AttendMeets.AMNo='cfa6ac48e5194b63a624955765455ea2' and dbo.AlumUsers.Mobile is not NULL ORDER BY dbo.AlumUsers.Mobile ,dbo.AttendMeets.IsCost DESC

---
SELECT
	am.am_id,a.no as activity_id ,am.`name`,a.Phone as phone, a.IsAudit as audit_status ,'admin' as audit_user,a.CostTime as audit_time,'400' as cost,a.IsCost as cost_status,'admin' as cost_audit_user,a.CostTime as cost_time,'1' as is_attend,DATE('2024-01-01') as attend_time,0 as del_flag,'admin' as create_by	,,a.CostTime as create_time,'admin' as update_by	,DATE('2024-11-01') as update_time,'' as remark
FROM
	attend_meet AS a
	LEFT JOIN sys_user AS s ON a.Phone = s.phonenumber
	LEFT JOIN am_alumnus AS am ON am.user_id = s.user_id
	WHERE am.am_id is not NULL
	ORDER BY a.`No`  , a.CostTime