Re: [SQL] Find NOT NULLs in a group of 20 columns

2011-01-10 Thread Tom Lane
gvim writes: > I'm struggling to find anything other than a complex stored proc to do this: > Out of a group of 20 columns return the rows in which: > 1. Only 1 of the 20 columns IS NOT NULL > 2. More than 1 of the 20 columns IS NOT NULL > Any ideas? Cast to int and add up? SELECT ... WHERE (

[SQL] Find NOT NULLs in a group of 20 columns

2011-01-10 Thread gvim
I'm struggling to find anything other than a complex stored proc to do this: Out of a group of 20 columns return the rows in which: 1. Only 1 of the 20 columns IS NOT NULL 2. More than 1 of the 20 columns IS NOT NULL Any ideas? gvim -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org