Run Code
|
API
|
Code Wall
|
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
code1
Select the latest id from last week from each different contact without repeating barcodes .....
Codigo_Completo
renaming JSON field
PostreSQL: product table
Professional Networking Social Media Website SQL Analysis
Tememons Dashboard
simple add function on sql
postgresql example hierarchy with addresses
nested array to table