X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DC77329E84 for ; Mon, 20 Sep 2004 19:08:16 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52965-09 for ; Mon, 20 Sep 2004 18:08:11 +0000 (GMT) Received: from msgdirector2.onetel.net.uk (msgdirector2.onetel.net.uk [212.67.96.149]) by svr1.postgresql.org (Postfix) with ESMTP id 8C247329E87 for ; Mon, 20 Sep 2004 19:08:08 +0100 (BST) Received: from bolek.coachhouse (213-78-109-155.friaco.onetel.net.uk [213.78.109.155]) by msgdirector2.onetel.net.uk (MOS 3.4.6-GR) with ESMTP id BWR65667; Mon, 20 Sep 2004 19:08:03 +0100 (BST) Received: (Exim 3.36) #1 (Debian)) protocol: esmtp id 1C9SRw-0005fM-00 ; Mon, 20 Sep 2004 18:59:40 +0100 Message-ID: <414F1A8B.2080101@numerixtechnology.de> Date: Mon, 20 Sep 2004 18:59:39 +0100 From: T E Schmitz Reply-To: mailreg@numerixtechnology.de User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rod Taylor Cc: pgsql-sql@postgresql.org Subject: Re: COUNT(*) to find records which have a certain number of References: <414F02FF.8000603@numerixtechnology.de> <1095697895.86376.3.camel@jester> In-Reply-To: <1095697895.86376.3.camel@jester> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200409/163 X-Sequence-Number: 19009 Hi Rod, Rod Taylor wrote: > On Mon, 2004-09-20 at 12:19, T E Schmitz wrote: > >>I figured it eventually. (The only thing I don't know is where to put >>the ORDER BY.) > > > Try this: > > SELECT brand_name, model_name > FROM (SELECT ... INTERSECT SELECT ...) AS t > ORDER BY ... That does the trick. You're a genius ;-) -- Regards/Gruß, Tarlika