Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Demo
CREATE TABLE yourtable ("month" timestamp, "marketid" int, "totalsold" int, "totalshipped" int, "lefttoship_thismonth" int) ; INSERT INTO yourtable ("month", "marketid", "totalsold", "totalshipped", "lefttoship_thismonth") VALUES ('2015-01-01 00:00:00', 1, 100, 50, 50), ('2015-01-01 00:00:00', 2, 10, 3, 7), ('2015-01-01 00:00:00', 3, 0, 0, 0), ('2015-01-02 00:00:00', 1, 0, 50, -50), ('2015-01-02 00:00:00', 2, 20, 0, 20), ('2015-01-02 00:00:00', 3, 0, 0, 0) ; select "month",marketid,totalsold,totalshipped,lefttoship_thismonth,sum(lefttoship_thismonth)over(partition by marketid order by month ) as TOTALLEFT From yourtable order by "month",marketid
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
1
Stack
Game Play Analysis (511,512,534,550)
Full text search
Webiste SQL Analysis
Inner Join
SQL hierarchical query. branch of responses.
Ultima Clase
code1
quiz 1
Please log in to post a comment.