You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. First thanks for Drizzle as a great product.
I would like to use the magic SQL query builder to have nested queries like that:
constresult: any=awaitdb.execute(sql` WITH RECURSIVE product_hierarchy AS ( SELECT ${products.id}${products.name},${products.instanceId},${products.description},${products.parentId}, 0 AS depth FROM ${products} WHERE id = ${startId} UNION ALL -- Recursive member: Fetch child products, incrementing the depth each time SELECT p.id, p.name, p.instance_id AS "instanceId", p.description, p.parent_id AS "parentId", ph.depth + 1 AS depth FROM data.products p INNER JOIN product_hierarchy ph ON p.parent_id = ph.id WHERE ph.depth < ${maxDepth} ) SELECT * FROM product_hierarchy; `);
Is it possible to use the ${table.columnname}-Syntax for Aliases here?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello. First thanks for Drizzle as a great product.
I would like to use the magic SQL query builder to have nested queries like that:
Is it possible to use the ${table.columnname}-Syntax for Aliases here?
Beta Was this translation helpful? Give feedback.
All reactions