两个日期之间的值之和 [英] sum of values between two dates

查看:96
本文介绍了两个日期之间的值之和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做学生出勤系统的项目。我有一个学生出勤数据库,每天有滚动号和出勤率。

例如。 1月份学生出勤

| roll_no | 2015年1月1日|至| 31-01-2015 |



每天出勤记录为1或0 ...... 1在线和0缺席



来计算违约者,老师会输入开始日期和结束日期,然后每卷都没有计算总出勤率。



for例如。 2015年10月10日至2015年1月20日期间所有学生或学生的出勤率= 3。



我希望显示该违规者名单gridview的形式为roll no和total attendance,aslo想要存储违规者列表



i我正在使用asp.net c#和sql server 2008.

i am doing project on student attendance system.i have a database of student attendance with roll no and attendance of each day.
eg. attendance of students in January
|roll_no | 1-01-2015| to |31-01-2015|

each day attendance is recorded with 1 or 0...1-present and 0-absent

to calculate defaulter, teacher will enter start date and end date,and then for each roll no total attendance is calculated.

for eg. attendance between 10-01-2015 to 20-01-2015 for all students or for student roll no =3.

and i want to display that defaulter list in the form of gridview as roll no and total attendance and aslo want to store the defaulter list

i am using asp.net c# and sql server 2008.

推荐答案

我不确定我是否理解了这种情况,但是如果你想在任何两个日期之间加总值,那就是:



I'm not sure if I understood the situation correctly but if you want to sum a value between any two dates one wai is:

SELECT SUM(ColumnToSum)
FROM TableName
WHERE TableName.DateColumn BETWEEN date1 AND date2


这篇关于两个日期之间的值之和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆