如何计算多个列而不是Calendar表的行? [英] how can I count multiple Columns instead of Rows of a Calendar table?
本文介绍了如何计算多个列而不是Calendar表的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为bat.student_attendance的表,其中包含每月每天30列。
我曾经在当前日期更新当天列,但也想更新当前总日期和每天总共没有天数,因为我必须计算所有列,但我没有完成它.plz确实建议。
I have a table named "bat.student_attendance" which contains 30 columns for each day of month.
I used to update that day column on current date but also want to update total present days and total absent days on each day, for that I have to count all columns but i didnt get it done..plz do suggest .
1 12 52 5 2014-01-04 00:00:00.000 p p p p p a a p p l p p p p p p a p p NULL p p p p p p NULL a p p NULL NULL NULL
2 12 52 3 2014-01-04 00:00:00.000 p p p p NULL a p p p p NULL a a p p p a p l NULL NULL a p p l p p p a p p NULL NULL
3 12 52 6 2014-01-04 00:00:00.000 p p p a p p l p p p p p p p p p p p p NULL p a p a p a p a p a NULL NULL NULL
4 12 52 9 2014-01-04 00:00:00.000 p p p p p p p p p a l a a NULL a a p p p NULL a p p p a p p p p p p NULL NULL
这是我的桌子有价值。
Here is my table with value.
推荐答案
表结构如
Table structure like
StudentID [Date] IsPresent
1 20-04-2014 true
2 20-04-2014 false
3 21-04-2014 true
4 21-04-2014 true
5 22-04-2014 false
剩下的东西都算是数不胜数所有你自己查询。
rest of things lie count & all you query itself.
这篇关于如何计算多个列而不是Calendar表的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文