functions
authorgamesguru <mathmuncher11@gmail.com>
Wed, 30 Sep 2020 21:21:24 +0000 (17:21 -0400)
committergamesguru <mathmuncher11@gmail.com>
Wed, 30 Sep 2020 21:21:24 +0000 (17:21 -0400)
sql/functions.sql

index c77d7e3b697ec5cd92b0af66e652026367235644..d47e9ab713a56981c817fa55afb2331d0f77d159 100644 (file)
@@ -151,3 +151,20 @@ WHERE
   OR tricep.value
   OR suprailiac.value;
 
+--------------------------------
+-- Recipes overview
+--------------------------------
+
+SELECT
+  id,
+  name,
+  COUNT(recipe_id) AS n_foods,
+  SUM(grams) AS grams,
+  guid,
+  created
+FROM
+  recipes
+  LEFT JOIN recipe_dat ON recipe_id = id
+GROUP BY
+  id;
+