Skip to content

Commit

Permalink
adding SUM function
Browse files Browse the repository at this point in the history
  • Loading branch information
Darcicat committed Oct 28, 2024
1 parent 8c4d97a commit 7404b76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sql/fashion_magazines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SELECT
customers.customer_name AS Customer,
--subscriptions.subscription_length*subscriptions.price_per_month AS "Amount Due"
'$' || printf('%.2f', subscriptions.subscription_length * subscriptions.price_per_month) AS "Amount Due"
'$' || printf('%.2f', SUM(subscriptions.subscription_length * subscriptions.price_per_month)) AS "Amount Due"
FROM orders
LEFT JOIN customers ON orders.customer_id = customers.customer_id
LEFT JOIN subscriptions ON orders.subscription_id = subscriptions.subscription_id
Expand Down

0 comments on commit 7404b76

Please sign in to comment.