mysql convert column into row -


i have view created form multiple tables view structure is

id     col1     col2     col3     col4  101         b     b     null  102     c     f         g 

and on (this sample)

i want create view like

id     col_name     value  101     col1      101     col2     b  101     col3     b  101     col4     null  102     col1     c  102     col2     f  102     col3      102     col4     g 

and on

can 1 plzzz

maybe this:

select id,'col1' colname, col1 value table1 union select id,'col2' colname, col2 value table1 union select id,'col3' colname, col3 value table1 union select id,'col4' colname, col4 value table1 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -