1 point by yimingchen 6 weeks ago | flag | 1 comment
yimingchen 6 weeks ago | flag

The following code in the section Empty Group is supposed to be

| Pid | Sold |
| :-------: | :---: |
| apple | 10 |
| orange | 2 |
| banana | -3 |

instead of

| Pid | Sold |
| :-------: | :---: |
| apple | 10 |
| orange | 2 |
| banana | -2 |


table Orders = with
  [| as Pid, as OrderDate, as Quantity |]
  [| "apple",  date(2020, 4, 15), 3 |]
  [| "apple",  date(2020, 4, 16), 7 |]
  [| "orange", date(2020, 4, 16), 2 |]
 
table Products = with
  [| as Pid, as MyDefault |]
  [| "apple",  -1 |]
  [| "orange", -2 |]
  [| "banana", -3 |]
 
Products.Sold = sum(Orders.Quantity)
  default Products.MyDefault
  by Orders.Pid
  at Products.Pid
 
show table "Products" with
  Products.Pid
  Products.Sold