Results 1 to 1 of 1
  1. #1
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    9

    Question Unanswered: recursive nested query

    Hello.
    I have to make a recursive query like this one:
    Code:
    WITH temptab(org_id, superior_id) AS
    	(   
    	SELECT root.org_id, root.superior_id
    	FROM bns_org root
    	WHERE  root.org_id IN (SELECT ... FROM ...)
         UNION ALL
    	SELECT sub.org_id, sub.superior_id
    	FROM bns_org sub, temptab super
    	WHERE  sub.superior_id = super.org_id
    	)
    SELECT emptab.org_id FROM temptab!
    Now I have to use this query in another query.
    The nested query
    Code:
    SELECT * FROM (SELECT ... FROM ... )
    is valid. But my query
    Code:
    SELECT * from (with temptab(org_id, superior_id) AS ( SELECT ...) select * from temptab)
    is invaild. :-( How to use the WITH query in another query?
    Last edited by doofkopp; 06-04-04 at 10:44. Reason: formating

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •