X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C9927D1C9E9 for ; Mon, 3 Nov 2003 00:43:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 44628-05 for ; Sun, 2 Nov 2003 20:42:49 -0400 (AST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by svr1.postgresql.org (Postfix) with ESMTP id C18D5D1CA93 for ; Sun, 2 Nov 2003 20:42:45 -0400 (AST) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AGSnv-000177-00 for ; Mon, 03 Nov 2003 01:42:47 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AGSnu-00016z-00 for ; Mon, 03 Nov 2003 01:42:46 +0100 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AGSnu-0005eT-00 for ; Mon, 03 Nov 2003 01:42:46 +0100 From: Mark Stosberg Subject: Re: A tricky sql-query... Date: Mon, 3 Nov 2003 00:42:46 +0000 (UTC) Lines: 14 Message-ID: References: X-Complaints-To: usenet@sea.gmane.org X-Archive: encrypt User-Agent: slrn/0.9.8.0 (FreeBSD) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/7 X-Sequence-Number: 15822 On 2003-10-22, Timo wrote: > > You can't have any recursion in an pure sql-query, can you? It depends on how you think of recursion, I'd say. You join on the same table a number of times, by giving it a different alias each time. You have to manually specify (or generate with application code) all these aliases and joins, though. Sometimes people use this technique to implement tree structures in SQL. Mark -- http://mark.stosberg.com/