How do I convert this connect by oracle sql query to Postgres recursive with?
SELECT DISTINCT connect_by_root(po1.product_offer_name) AS Offer
po.product_offer_id product_offer_id
FROM product_offer_offer poo,
product_offer po,
product_offer po1
WHERE connect_by_isleaf = 1
AND po.product_offer_id = poo.child_product_offer_id
AND po1.product_offer_id = poo.product_offer_id
START WITH poo.product_offer_id IN
(SELECT product_offer_id
FROM product_offer
WHERE sysdate BETWEEN available_start_date AND available_end_date
AND product_id IS NOT NULL
AND (:TopLevelOffer = 0 OR product_offer_id = :TopLevelOffer)
)
CONNECT BY prior poo.child_product_offer_id = poo.product_offer_id
What should be the recursive query for this oracle code trying to get products and their child products