From 023ecb31a11bceeba5e57b5f447f7d94ba1c1b54 Mon Sep 17 00:00:00 2001 From: Sorrel Harriet <s.harriet@gold.ac.uk> Date: Sun, 6 Nov 2016 20:01:57 +0000 Subject: [PATCH] amend --- lab-5/vending-machine/sql/schema.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lab-5/vending-machine/sql/schema.sql b/lab-5/vending-machine/sql/schema.sql index e80b1f4..b1cb786 100755 --- a/lab-5/vending-machine/sql/schema.sql +++ b/lab-5/vending-machine/sql/schema.sql @@ -30,7 +30,8 @@ INSERT INTO Selection VALUES SELECT drink_name, code, price FROM DrinkOption ORDER BY code; -SELECT do.drink_name, COUNT(s.id) FROM DrinkOption do +SELECT do.drink_name, COUNT(s.id) AS qty_bought FROM DrinkOption do INNER JOIN Selection s ON s.option_code=do.code -GROUP BY do.drink_name; +GROUP BY do.drink_name +ORDER BY do.code; -- GitLab