先看下面这句sql,老是报错!
select sum(hs) as thehs, sum(sjf) as thesjf, sum(gczzj) as thegczzj, sum(tfl) as thetfl from job_list GROUP BY tfl desc
其中hs、sjf、gczzj、tfl都是字符型字段,但是存入的是数字,我想对其做统计,可是不能成功,高手们能给改改?或者告诉我原因吗?谢谢!
...全文
767打赏收藏
如何对字符型字段做求和统计?在线等候(100分!)
先看下面这句sql,老是报错! select sum(hs) as thehs, sum(sjf) as thesjf, sum(gczzj) as thegczzj, sum(tfl) as thetfl from job_list GROUP BY tfl desc 其中hs、sjf、gczzj、tfl都是字符型字段,但是存入的是数字,我想对其做统计,可是不能成功,高手们能给改改?或者告诉我原因吗?谢谢!
select sum(convert(real,hs)) as thehs, sum(convert(real,sjf)) as thesjf, sum(convert(real,gczzj)) as thegczzj, sum(convert(real,tfl)) as thetfl
from job_list
ORDER BY thetfl desc