我不能在查询中声明

i cant declaring in query

@a =( CASE WHEN amount IS NOT NULL THEN amount1 
      WHEN percentage IS NOT NULL THEN sco.amount *  1 + (percentage / 100) END) AS data1

没有@a我得到结果但是有@a我没有得到结果

像下面这样尝试,你错过了:

@a :=( CASE WHEN amount IS NOT NULL THEN amount1 
          WHEN percentage IS NOT NULL THEN sco.amount *  1 + (percentage / 100) END) AS data1