SELECT TenantId,ModuleCode,MetricLevel,MetricCode,MetricName,ParentId,Direction,Unit,IsEnabled,SortNo FROM ado_smart_ops_kpi_master WHERE TenantId=838257186181189 AND ModuleCode IN ('S3','S5','S6','S7') AND IsEnabled=1 ORDER BY ModuleCode,MetricLevel,SortNo; SELECT tenant_id,factory_id,COUNT(*) row_count,MAX(alert_time) latest_alert FROM ado_s8_alert_record WHERE tenant_id IN (838257186181189,838257212780613,838257237606469) AND is_deleted=0 GROUP BY tenant_id,factory_id ORDER BY tenant_id,factory_id; DESCRIBE ado_s8_alert_record; SELECT TenantId,FactoryId,RecID,ExceptionCode,ExceptionType,ExceptionLevel,ExceptionDesc, Status,CreateTime,UpdateTime FROM ScheduleExceptionMaster WHERE TenantId IN (838257186181189,838257212780613,838257237606469) ORDER BY TenantId,RecID DESC LIMIT 30;