select tt.school,
        count(tt.id) astoBeScreenCount,
        count(tt.screen_tag = '1' or null) as screenedCount,
        count(tt.symptom_tag = '1' or null) as symptomCount,
        count(tt.tst_exam_tag = '1' or null) as tstExamCount,
        count(tt.tst_strong_positive_tag = '1' or null) as tstStrongPositiveCount,
        count(tt.igra_exam_tag = '1' or null) as igraExamCount,
        count(tt.igra_strong_positive_tag = '1' or null) as igraStrongPositiveCount,
        count(tt.id) as chestExamCount,
        count(tt.chest_exam_tag = '1' or null) as chestExamRealCount,
        count(tt.diagnosis_tag = '1' or null) as diagnoseTbCount,
        count(tt.infect_tag = '1' or null) as tbInfectCount,
        count(tt.tb_receive_treatment_tag = '1' or null) as tbInfectTreatedCount,
        count(tt.complete_treat_tag = '1' or null) as completeTbTreatCount,
CASE 
    WHEN age > 15 THEN
        1
    ELSE
        2
END as agegroup
        from t_tb tt
        where tt.people_type = '0'
                GROUP BY CASE 
    WHEN age > 15 THEN
        1
    ELSE
        2
END,school ORDER BY school;

测试 哈哈哈 我好像会使用了哦


慈祥的茶壶
1 声望1 粉丝

下一篇 »
SpringBoot入门

引用和评论

0 条评论