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 736A88B9E7A for ; Wed, 16 Feb 2005 19:59:08 +0000 (GMT) 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 41707-09 for ; Wed, 16 Feb 2005 19:58:35 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 2388A8B9FB8 for ; Wed, 16 Feb 2005 19:43:15 +0000 (GMT) Received: (qmail 18544 invoked by uid 500); 16 Feb 2005 19:58:22 -0000 Date: Wed, 16 Feb 2005 13:58:22 -0600 From: Bruno Wolff III To: Ray Madigan Cc: Pgsql-Sql Subject: Re: Count Columns Message-ID: <20050216195822.GA18513@wolff.to> Mail-Followup-To: Ray Madigan , Pgsql-Sql References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/177 X-Sequence-Number: 20288 On Wed, Feb 16, 2005 at 10:09:05 -0800, Ray Madigan wrote: > > Is there a way to count the number of null or not null columns in a row and > have an output column that has that count as the value? One way to do this would be to create a CASE clause for each column that returns 1 or 0 depending on whether the column is null or not and add these expressions up.