I have a MYSQL table which has about 350 columns. There are most 'empty' values and I need to merge several rows in one and replace 'empty' values by a non empty value. My table looks like this:
id|col1|col2|col3|cola|col_b|...|col350
1 |12 |4 |3 |-77 |-77 |...|-77
2 |12 |-77 |-77 |2 |-77 |...|-77
3 |12 |-77 |-77 |-77 |6 |...|-77
4 |12 |-77 |-77 |-77 |-77 |...|6
5 |13 |3 |-77 |-77 |-77 |...|-77
6 |13 |-77 |5 |-77 |-77 |...|-77
...
-77 is a replacement for empty values. In col1 is an id of datasets witch belongs together.
I need a select query to merge non 'empty' values to one result row per col1-id. For col1-id 12 it should looks like this:
1 | 12 | 4 | 3 | 2 | 6 | ... | 6
Does someone have an idea how to do this?
Aucun commentaire:
Enregistrer un commentaire