You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE OR REPLACE TABLE sales (
sale_id INT UNSIGNED NOT NULL,
product_id INT UNSIGNED NOT NULL,
customer_id INT UNSIGNED NOT NULL,
sale_date DATE NOT NULL,
quantity INT NOT NULL,
net_paid DECIMAL(10, 2) NOT NULL
)
Query:
OK
SELECT customer_id, sale_id, net_paid,
truncate(SUM(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date), 4) AS running_total,
AVG(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date) AS running_avg
FROM sales
ORDER BY customer_id, sale_date
LIMIT 10;
Error
SELECT customer_id, sale_id, net_paid,
truncate(SUM(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date), 4) AS running_total,
truncate(AVG(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date), 4) AS running_avg
FROM sales
ORDER BY customer_id, sale_date
LIMIT 10;
Error:
1006=>Unable to get field named "5". Valid fields: ["2", "3", "10"]
The text was updated successfully, but these errors were encountered:
Summary
Table:
Query:
Error:
The text was updated successfully, but these errors were encountered: