Blog Home / Tags : MySQL

SQL row sum

Given an SQL table

ID Amt
-- ---
1 100
2 200
3 300

Please write a MySQL statement to produce the following result:

ID Amt Total
-- --- -----
1 100 100
2 200 300
3 300 600

And here is an example SQL:

SELECT a.ID, a.Amt, sum(b.Amt) AS Total
F
Dept: SIDU | Read: 10349 | 2018-11-02
Tags: MySQL, Test


Category

New Replies

» Optional sidu_fk table
» SIDU SQL in charts: howto
» Godaddy Magic Quotes Problem
» SIDU import/export data clean
» How to install databases
» SIDU feature request and bug
» Benson Bank Feature Request and Bug Report