Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7KHElP99471 for ; Mon, 20 Aug 2001 13:14:48 -0400 (EDT) (envelope-from reedstrm@rice.edu) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id 3F42868A17; Mon, 20 Aug 2001 12:14:43 -0500 (CDT) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.22 #1 (Debian)) id 15YsYZ-0001M5-00; Mon, 20 Aug 2001 12:09:43 -0500 Date: Mon, 20 Aug 2001 12:09:43 -0500 From: "Ross J. Reedstrom" To: Mark Mikulec Cc: pgsql-sql@postgresql.org Subject: Re: Sequential select queries...?? Message-ID: <20010820120943.A5124@rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , Mark Mikulec , pgsql-sql@postgresql.org References: <3B79C512.9F6E09B7@badger.ac.brocku.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3B79C512.9F6E09B7@badger.ac.brocku.ca> User-Agent: Mutt/1.3.18i X-Archive-Number: 200108/253 X-Sequence-Number: 4493 Well, a short answerto your direct question would be: Select id from T where name = 'bleh' UNION ALL Select id from T where description = 'bleh'; But since you described what your trying to do, not just how your trying to do it, doesn't this do it for you? SELECT id from T where name = 'bleh' and description = 'bleh'; That should give you just the ones where it appears in both. Ross On Tue, Aug 14, 2001 at 08:40:50PM -0400, Mark Mikulec wrote: > Hello, > > At first I thought what I was trying to do was simple and could be done > easily - but alas, I've spent way too much time and could not figure out > how to get the results in question. > > Let's say I have a table T comprised of id of type integer, name and > description both of type text. > > What i'd like to do is the following: > > Select id from T where name = 'bleh'; > > and > > Select id from T where description = 'bleh'; > > and result both results in the same result set. That is, duplicate id's > if they appear. So then I could do a GROUP BY and a COUNT to see how > many appeared in only one, and how many appeared in both. > > Could someone help me? I've tried countless different sql queries, can't > seem to get one to work. If I can just get those duplicate id's in the > query.. then I'd be laughing and then I can complete my task. > > Thanks in advance, > > Mark > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster