Say I want to look up the ltree paths for "active" recipes, and then use the those paths to find descendants of those recipes.
# recipes
name | category | path
-------------------------
Main active recipeA
Sides inactive recipeB
Lettuce active recipeC
Drinks inactive recipeD
abc recipeA.tacos
def recipeA.hamburgers
ghi recipeB.sausages
jkl recipeC.lettuce
mno recipeC.fries
pqr recipeD.cola
Here is my pseudo-code query (which is obviously incorrect):
SELECT name, category, path FROM recipes WHERE category='active'......then SELECT name, path FROM recipes WHERE path <@ '(IDENTIFIED|RECIPE|PATHS|HERE)'
The results would give me records with paths like:
abc recipeA.tacos
def recipeA.hamburgers
jkl recipeC.lettuce
mno recipeC.fries
Is there a way to do it correctly in one query?