search

Home  >  Q&A  >  body text

mysql - How to use sql column value as field name of new table?

Could you please let me know how to implement the result column value in the above picture as the field name of the new table? Please give me some advice, thank you all

PHP中文网PHP中文网2825 days ago638

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-18 10:58:14

    select date,sum(case when result='win' then 1 else 0 end) win,sum(case when result='lose' then 1 else 0 end) lose from tbl group by date;

    reply
    0
  • Cancelreply