浏览代码

Modify the function to return the biggest quantity

DricomDragon 5 年之前
父节点
当前提交
664e290af8
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      SQL/plpgsql/create_biggest_ordered_quantity.sql

+ 1 - 1
SQL/plpgsql/create_biggest_ordered_quantity.sql

@@ -3,7 +3,7 @@ $$
 DECLARE
     ans INTEGER;
 BEGIN
-    SELECT ori_quantity FROM OrderedItem WHERE ori_id = 1 INTO ans;
+    SELECT ori_quantity FROM OrderedItem ORDER BY ori_quantity DESC INTO ans;
 
     RETURN ans;
 END;