Created
November 5, 2018 15:42
-
-
Save grindtildeath/d0618f2f8170ebb5e1618a0e814edce4 to your computer and use it in GitHub Desktop.
odoo sql stock location tree
This file contains 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 characters
WITH RECURSIVE location_tree AS ( | |
SELECT loc1.id, loc1.location_id, loc1.name | |
FROM stock_location loc1 | |
WHERE id = 2024 | |
UNION ALL | |
SELECT loc2.id, loc2.location_id, loc2.name | |
FROM stock_location loc2 | |
INNER JOIN location_tree lt ON lt.id = loc2.location_id | |
) SELECT id | |
FROM location_tree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment