Re: Count Columns

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ray Madigan <ray(at)madigans(dot)org>
Cc: Pgsql-Sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Count Columns
Date: 2005-02-16 19:58:22
Message-ID: 20050216195822.GA18513@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message PFC 2005-02-16 20:01:10 Re: Matching a column against values in code
Previous Message PFC 2005-02-16 18:56:25 Re: Relation in tables