兄弟,既然sp_a ,sp_b,sp_c 之间没有关系,那就分开建表呀,mysql 是关系型数据库,你的表本身设计的就很有问题,所以你写sql的时候才会很困惑。

解决方案 »

  1.   

    select * from(
    select name, a as value from table where sp_a like '%胎%'
    union all
    select name, b as value from table where sp_b like '%胎%'
    union all
    select name, c as value from table where sp_c like '%胎%'
    ) data order by value limit 1;
      

  2.   

    注意到所有字段为 varchar,所以  order by value 改一下
     order by cast(value as decimal)