0

Hy i have a db with 1 collum(with 20rows) i whant to create a custom table view of this database with the sum at the end of the table but with custom search function, i cand find an script to do this for me?
Thanks

2
Contributors
5
Replies
29
Views
3 Years
Discussion Span
Last Post by AndrisP
0

It's a very easy - sum of column "c3" (all rows of table "t1")

SELECT SUM(`c3`) FROM `t1`;

each row sum of columns "c3", "c4", "c5"

SELECT *,(`c3`+`c4`+`c5`) AS `sum` FROM `t1`;

and total sum of columns "c3", "c4", "c5" all rows of table "t1"

SELECT *,(`c3`+`c4`+`c5`) AS `sum`,SUM(`c3`+`c4`+`c5`) AS `total` FROM `t1`;

Edited by AndrisP

0

You can add where clause in this queries or select from stored procedure or view

Edited by AndrisP

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.