From: gamesguru Date: Wed, 30 Sep 2020 21:21:24 +0000 (-0400) Subject: functions X-Git-Tag: 0.0.0~8 X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=8cad29a2ab3740013c317c0cc94b43a484dbd49d;p=nutratech%2Fnt-sqlite.git functions --- diff --git a/sql/functions.sql b/sql/functions.sql index c77d7e3..d47e9ab 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -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; +