I have t开发者_高级运维able that I want to sum 3 rows of one column how can I do that?
If I understand your question correctly - you should use the SUM() function
SELECT SUM(the_column)
FROM the_table
WHERE condition-to-get-your-three-rows
A "WHERE" clause will allow to specify which 3 rows you want to be summed up. Some examples of "WHERE" clauses are below:
WHERE row_id < 3
or
WHERE active = 'Yes'
So the above statement may look like
SELECT SUM(the_column)
FROM the_table
WHERE active = 'Yes'
SELECT
SUM(table.column1) + SUM(table.column2) + SUM(table.column3)
FROM table
精彩评论