Advertisement
ash_360

SQL - Rolling Sum

Jul 9th, 2022
4,230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.63 KB | None | 0 0
  1. # Rolling SUM
  2.  
  3. CREATE TABLE f_FoodTruck_Transactions
  4. (
  5.     food_truck_id INT,
  6.     paid_amount FLOAT,
  7.     date_of_purchase DATE,
  8.     datecreated datetime DEFAULT CURRENT_TIMESTAMP
  9. );
  10.  
  11. INSERT INTO f_FoodTruck_Transactions VALUES
  12. (1,10.2,'2018-01-01','2018-01-01'),
  13. (1,36.32,'2018-01-02','2018-01-02'),
  14. (1,120.19,'2018-01-03','2018-01-03'),
  15. (1,130.24,'2018-01-04','2018-01-04'),
  16. (1,210.42,'2018-01-05','2018-01-05'),
  17. (2,50.9,'2018-01-01','2018-01-01'),
  18. (2,110.52,'2018-01-02','2018-01-02'),
  19. (2,50.29,'2018-01-03','2018-01-03'),
  20. (2,70.12,'2018-01-04','2018-01-04'),
  21. (2,90.2,'2018-01-05','2018-01-05'),
  22. (2,110.33,'2018-01-06','2018-01-06')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement