-
慕的地10843
正确的方法如下:DROP TABLE IF EXISTS my_table;CREATE TABLE my_table(id SERIAL PRIMARY KEY,srno INT NOT NULL,subject VARCHAR(20) NOT NULL,mark INT NOT NULL);INSERT INTO my_table VALUES(1,1,'english',52),(2,1,'maths',52),(3,1,'science',52);SELECT srno , SUM(mark) total FROM my_table GROUP BY srno; +------+-------+ | srno | total | +------+-------+ | 1 | 156 | +------+-------+
-
犯罪嫌疑人X
尝试这个 :SELECT *, (english + maths + science) AS Total FROM table;
-
红颜莎娜
尝试这样的事情:SELECT srno, name, english, maths, science, (english+maths+science) As TotalMarks FROM `table_name`
-
斯蒂芬大帝
那么你可以试试这两种方法:select * from Your_Table_Name;当您显示结果时,您可以添加所有这些值,例如:srno name english maths science TotalMarks$id $name $english $maths $science ($english+$maths+$science)或者select id, name, english, math, science, (english+maths+science) as Total from Your_Table_Name;