php: how to change string data become numeric data

前端 未结 3 2010
我在风中等你
我在风中等你 2021-01-29 14:27

can you tell how to change this result in php and mysql script:

  Model                  Class
Ball                        S
Book                        A
Spoon
         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-29 15:04

    SELECT `Model`,
    IF(`Class`='S', 1, 0) AS `S`,
    IF(`Class`='A', 1, 0) AS `A`,
    IF(`Class`='B', 1, 0) AS `B`,
    IF(`Class`='C', 1, 0) AS `C`
    FROM `inspection_report`
    

提交回复
热议问题