Last active
May 22, 2020 13:46
-
-
Save hackimov/8cea1582d4cad87af9f34d9ed144cdcd to your computer and use it in GitHub Desktop.
Revisions
-
hackimov revised this gist
May 22, 2020 . 1 changed file with 24 additions and 25 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,25 @@ WITH RECURSIVE catalogs_tree AS ( SELECT catalog_id, 1 AS hierarchy_level FROM catalog WHERE catalog_id = '".$catalog_id."' AND mailbox_id = '".$session['mailbox_id']."' UNION ALL SELECT cat.catalog_id, ct.hierarchy_level + 1 FROM catalog cat, catalogs_tree ct WHERE cat.parent_catalog_id = ct.catalog_id ) SELECT products.* FROM catalogs_tree INNER JOIN products on catalogs_tree.catalog_id = products.catalog_id; -
hackimov revised this gist
May 22, 2020 . No changes.There are no files selected for viewing
-
hackimov created this gist
May 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ WITH RECURSIVE catalogs_tree AS ( SELECT catalog_id, 1 AS hierarchy_level FROM catalog WHERE catalog_id = '".$catalog_id."' AND mailbox_id = '".$session['mailbox_id']."' UNION ALL SELECT cat.catalog_id, ct.hierarchy_level + 1 FROM catalog cat, catalogs_tree ct WHERE cat.parent_catalog_id = ct.catalog_id ) SELECT products.* FROM catalogs_tree INNER JOIN products on catalogs_tree.catalog_id = products.catalog_id "