房天下 > 房天下问答 > 业主生活 > 其他
  • Sql统计某一字段中每种情况的数量 Access数据库

    表字段如下:ID CheckId1 11 01 21 11 31 01 02 22 32 3统计结果要求如下:ID “0” “1” “2” “3”1 3 2 1 12 0 0 1 2

    提问者:maidodo

    发布于2010-12-17

共1个回答
  • cuipengzr85 丨Lv 4
    select ID,sum(case CheckId when 0 then 1 else 0 end) as 1,sum(case CheckId when 1 then 1 else 0 end) as 2,sum(case CheckId when 2 then 1 else 0 end) as 3,sum(case CheckId when 3 then 1 else 0 end) as 4 from 表 group by ID
    +11 2010-12-17 举报
热门人气推荐
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。