Last active
June 7, 2022 20:04
-
-
Save prmoore77/71bee9be36bd848ef15bb046ff565e60 to your computer and use it in GitHub Desktop.
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
CREATE OR REPLACE TEMPORARY TABLE product_nodes_temp | |
AS | |
SELECT node_id | |
, node_natural_key | |
, node_name | |
, level_name | |
, parent_node_id | |
, CASE WHEN parent_node_id IS NULL | |
THEN TRUE | |
ELSE FALSE | |
END AS is_root | |
, CASE WHEN node_id IN (SELECT parent_node_id | |
FROM product_nodes | |
) | |
THEN FALSE | |
ELSE TRUE | |
END AS is_leaf | |
FROM product_nodes | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment