I haven't done very many complex queries in sql, and maybe Im thinking about
my problem wrong but:
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?
I want to create a ranking of the row based upon the number of not null
columns are in the row. I want to have to use as few seperate queries as
possible.
The table that i want to do the query on is either a view or a temporary
table, I guess depending on if I can do this easily or if brut force is
required, Or if I have to think of a new way to solve my problem.
The table is like
CREATE TABLE myTbl ( name varchar(5) primary key, a varchar(5), b
varchar(5), c varchar(5) );
ending table looks like
name | a | b | c |
foo | A | | C |
bar | A | B | |
baz | A | B | C |
and I want the result to look like
foo 2
bar 2
baz 3
Thanks in Advance