Return result via column view instead row view in mysql -



Return result via column view instead row view in mysql -

i want know if there way homecoming result via column. simple select statement homecoming like

_________________ | id | name | | 1 | abc | | 2 | abc1 | | 3 | abc2 |

is there way retrieve result this

| 1 | abc | 2 | abc1| 3 | abc2|

or like

|1 | 2 | 3 | |abc |abc1|abc2|

i returning 4 columns, , using info header of other queries. please help me. thanks

you can accomplish using pivot. need utilize max , group by simulate pivot.

select id, max(case when id = 1 name end) col1, max(case when id = 2 name end) col2 table1 grouping id

you need decide based on criteria need grouping data. seek example.

mysql

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -