Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
StudentId我有一个名为, StudentName, SubjectNAme,的 4 列的表SubjectMark。
StudentId
StudentName
SubjectNAme
SubjectMark
我想写一个查询来获得一个视图,其中包含两个名为StudentName和的字段Total。总分由相应学生的科目分数相加得出。
Total
SELECT StudentName, sum(SubjectMark) FROM table_name GROUP BY StudentId, StudentName
句法:
SELECT SUM(column_name) FROM table_name;
column_name 是您要求和的列的名称
table_name 是表名。