sql - Return different rows for each column in a row -


i have data presented in multiple rows , columns 0 or 1 values. i'm trying create unique row each 1, there multiple 1's in row. ex:

**a    b    c    d**   1    0    1    1   0    0    0    1   1    1    0    0 

i have return 6 rows, in 1 column so

**return**           c      d      d           b 

thanks in advance!

you can union all statement:

select val ((select 'a' val t = 1) union       (select 'b' t b = 1) union       (select 'c' t c = 1) union       (select 'd' t d = 1)      ) t 

as note: hope have other columns can include in output. sql tables are, definition, not ordered. so, have no idea in example of original source given value.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -