简体   繁体   中英

How to change column values into rows values in mysql?

Hi to everyone,

I am working in xml feed parsing section.In my database table structure is shown like this:

显示图片 Here my needs is every sponsor are placed in single row not in multiple columns. For example :

   bookmaker_quote      scommessatipo_quote       q_1     q_2    q_3

    PINNACLE              1x2                     6.47    4.31   1.60
    BETCLICK              1x2                     5.80    2.25   2.15
    PADDYPOWER            UNDER/OVER 3.5          1.36    3.25   -

I want to show quotavalore_quote values comes under single rows

How to show above table format using mysql query?

Updated

i show using group concat

SELECT distinct(bookmaker_quote) as bb ,group_concat(quotavalore_quote) as aa  FROM `quote`  where id_odds=10 

this is result for group concat

bb           aa 

PINNACLE    6.47,4.31,1.60,5.80,2.25,2.15,11.00,1.03,3.80,1.25...

I get only one sponsor values , but i need to get all sponsor values..How to get this.......Please guide me..

You can turn rows into a column with GROUP_CONCAT function. Try with that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM