Suppose I have this table v:
a|b|c|d|e
| |2| |9
1| |3| |8
1| |4|4|7
|5|5|4|6
1|6|6| |5
And I would like to return the first non-NULL value of each column. I
can do somthing like:
SELECT * FROM (SELECT a FROM v WHERE a IS NOT NULL LIMIT 1),
(SELECT b FROM v WHERE b IS NOT NULL LIMIT 1),
(SELECT c FROM v WHERE c IS NOT NULL LIMIT 1),
(SELECT d FROM v WHERE d IS NOT NULL LIMIT 1),
(SELECT e FROM v WHERE e IS NOT NULL LIMIT 1);
to get 1|5|2|4|9. But is there a more convenient way? I don't think
I can define an aggregate function (similar to coalesce) since the
order will not be defined. But perhaps I'm missing the obvious
solution.
--
Steinar Midtskogen
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users