transpose - Changing a row into a column in mysql -
i have query in mysql returns following:
amount1 amount2 amount3 0.1 0.3 0.6
i need data in following format:
amount1 0.1 amount2 0.3 amount3 0.6
the query return single row 3 columns. how can change format?
thanks
your option select each column per query , union them all.
example:
select 'amount1' amount_type, `amount1` amount_value your_query_results union select 'amount2', `amount2` your_query_results union select 'amount3', `amount3` your_query_results
Comments
Post a Comment