美文网首页
统计每个分类的人数

统计每个分类的人数

作者: czm123 | 来源:发表于2019-04-01 00:00 被阅读0次
    //直接按钮搜索
     private void button5_Click(object sender, EventArgs e)
     {
         string s = "select department.deptno as 系号,department.deptname as 系名,";
         s += "sum(class.num) as 人数 ";
         s += "from class,department where class.deptno=department.deptno ";
         s += "group by department.deptno,department.deptname";
         loadLV(listView2, s);
     }
    
    
    
    //列表选择种类
            private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
            {
                string s = "select year as 年份,sum(num) as 学生人数 from class ";
                s += "where year =" + comboBox2.Text;
                s += " group by year";
                loadLV(listView2, s);
            }

    相关文章

      网友评论

          本文标题:统计每个分类的人数

          本文链接:https://www.haomeiwen.com/subject/fhgpbqtx.html