怎么申请做网站,wordpress首页多重筛选,上海芯片设计公司排名,网站上的漂浮怎么做前言
我们有时候需要对数据库查询的值进行一些处理,比如求平均值等操作,本文就是详细讲解这些用法,本文测试使用的数据库数据如下:
1、求平均值
求所有student_age 列的平均值 string sql = string.Empty; if (radioButton_AVG.Checked) {sql = “select AVG( student_…前言
我们有时候需要对数据库查询的值进行一些处理,比如求平均值等操作,本文就是详细讲解这些用法,本文测试使用的数据库数据如下:
1、求平均值
求所有student_age 列的平均值 string sql = string.Empty; if (radioButton_AVG.Checked) { sql = “select AVG( student_age ) as AVG_age from student_info”; }
2、计算数量
使用Count函数可以对列的行数进行统计,并且如果值为Null的行也要被统计的话则使用 COUNT(*),否则使用COUNT(列名)
2.1 将Null值带入计算
else if (radioButton_COUNT.Checked) { sql = “select COUNT(*)as Count_age from student_info”;//Null值带入计算 student_info";//null值不带入计算 }
2.2 不讲Null值带入计算
sql = "select C