Received: from bubbles.electricutopia.net (bubbles.electricutopia.net [63.214.178.76]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2SNiNU25299 for ; Wed, 28 Mar 2001 18:44:23 -0500 (EST) (envelope-from dave@slickness.org) Received: from localhost (dave@localhost) by bubbles.electricutopia.net (8.9.3/8.9.3) with ESMTP id PAA12179 for ; Wed, 28 Mar 2001 15:38:38 -0800 Date: Wed, 28 Mar 2001 15:38:38 -0800 (PST) From: David Olbersen X-X-Sender: To: Subject: Self-Referencing Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200103/593 X-Sequence-Number: 2263 Hello, I have a feeling this isn't going to make much sense, but I'm gonig to try anyway. What I'd like to do is be able to refer to an outer-SELECT from an inner-SELECT. I hope this makes sense. I need to be able to refer to the row that's being processed in a SELECT. I'm going to use the idea of 'this' referring to the row that's currently being processed. Here's the example of what I'd like: SELECT building_id, num_buildings, ( SELECT count( building_id ) FROM building_portals WHERE building_id = THIS.building_id ) FROM buildings; Am I making things too complicated, and if so will somebody *PLEASE* tell me the easier way to do this. Thanks. -- Dave