select b.templateId,GROUP_CONCAT(c.id),a.executeResult
from vrv_paw_rulestatus a, vrv_paw_terminaltobaselinereport b, vrv_paw_rule c, vrv_paw_template_rule d
where a.terOnlyId = b.terminalInfoId and b.templateId = d.templateId and d.ruleOnlyId = c.id
GROUP BY b.templateId,a.executeResult
原来的数据:
select b.templateId,c.id,a.executeResult from vrv_paw_rulestatus a, vrv_paw_terminaltobaselinereport b, vrv_paw_rule c, vrv_paw_template_rule d
where a.terOnlyId = b.terminalInfoId and b.templateId = d.templateId and d.ruleOnlyId = c.id
与我需要的数据不一样
加group by只加一个:id不全,丢失了;executeResult也丢失了
select b.templateId,c.id,a.executeResult from vrv_paw_rulestatus a, vrv_paw_terminaltobaselinereport b, vrv_paw_rule c, vrv_paw_template_rule d
where a.terOnlyId = b.terminalInfoId and b.templateId = d.templateId and d.ruleOnlyId = c.id
GROUP BY b.templateId