pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Ray Madigan <ray@madigans.org>
Cc: Pgsql-Sql <pgsql-sql@postgresql.org>
Subject: Re: Count Columns
Date: Wed, 16 Feb 2005 13:58:22 -0600
Message-ID: <20050216195822.GA18513@wolff.to> (raw)
In-Reply-To: <AEEJIDLCICLNLPOJHFEEIEDDFCAA.ray@madigans.org>
References: <AEEJIDLCICLNLPOJHFEEIEDDFCAA.ray@madigans.org>

On Wed, Feb 16, 2005 at 10:09:05 -0800,
  Ray Madigan <ray@madigans.org> 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.



view thread (2+ messages)

Message-ID: <20050216195822.GA18513@wolff.to>
Permalink:  ../20050216195822.GA18513@wolff.to/
Also on:    postgresql.org/message-id/20050216195822.GA18513@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, ray@madigans.org
  Subject: Re: Count Columns
  In-Reply-To: <20050216195822.GA18513@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox