diff --git a/lab-5/vending-machine/sql/schema.sql b/lab-5/vending-machine/sql/schema.sql index e80b1f4332df4ad9c8664cfd0e6b81a4b442bb76..b1cb786ea6ec01a9306fb8cb868b9df28ad20e81 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;