我如何计算表中记录中的数字并将其传递给gridview [英] how can i count number in records in a table and pass it to gridview
本文介绍了我如何计算表中记录中的数字并将其传递给gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我有一个课程表和另一个学生。
我需要填写一个网格视图以下信息
1-课程ID
2-课程名称
3-每个学生人数当然
不重复课程名称,意味着每一门课程都在一行。
注意:我我正在使用查询构建器。
比你
Hi every body
I have a table of courses and another for students.
And I need to fill a grid view with the following information
1- course ID
2- course name
3- number of students in each course
Without repeating the course name, means each course in a single row.
Note: I am using a query builder.
than you
推荐答案
那样使用Group BY子句sql
参考此链接
http://www.tizag.com/sqlTutorial/sqlgroupby.php [ ^ ]
to do that use the Group BY Clause of sql
refer this link
http://www.tizag.com/sqlTutorial/sqlgroupby.php[^]
选择
course_id,
count(students_id)
来自studentcoursestable
group by course_id
---格式语法和对象名称
---并且下次做一点google搜索
select
course_id,
count(students_id)
from studentcoursestable
group by course_id
---format syntax and object names
---and next time do a little google search
这篇关于我如何计算表中记录中的数字并将其传递给gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文