select completor , sum(score) as sums ,sum(score1) as sum1 from mask where year(date)= '$a' and flag=3  group by completor order by sums+sum1 desc order by sums+sum1 desc 这个地方该如何表示?谢谢各位了

解决方案 »

  1.   

    select …… sum(score+score1) AS tmp ……………… order by tmp desc
      

  2.   

    select completor , sum(score+score1) as o ,sum(score) assums ,sum(score1) as sum1 from mask where year(date)= '$a' and flag=3 group by completor order by o desc
     
    看这样是否能够满足你的要求!
      

  3.   

     order by  后面不能用表达式
      

  4.   

    where year(date)= '$a'
    改为
    where year(date)= "{$a}"
    变量要用""