My table is:
val1 val2 val3 ... precision test
-----|-----|-----|-------|-----------|---------
a | 11 | a | | 1 | x
b | 10 | null| ... | 2 | x
a | 0 | null| | 3 | x
e | 13 | b | | 1 | y
...
It's actually multiple similar tables that contain values for multiple tests and different processes and techniques in each row. Now, I want to create a "best of" table.
"Best of" table should look like:
val1 val2 val3 ... precision test
-----|-----|-----|-------|-----------|---------
a | 10 | a | | 3 | x
e | 13 | b | | 1 | y
The rules are:
- group by test
- pick for each column a defined (not 0, null, unset) value with highest precision available
- if all values should be null or not set just stick to the one with highest precision
Is this even possible in SQLite syntax? Can this be done without a lot of hardcoded subqueries for each column?