select campo1 as AGR_Number, campo2 as fattura,
campo76 as cod_periodo, campo78 as cod_scenario,
campo11 as origine, campo8 as Stazione,
campo13 as agent, campo30 as AAT_RATE,
sum (cast(campo30 as numeric (9,2))) AS AAT_rate
from map_dati_trasformati
where cod_mappatura = 'CARICA_NOL_CSV'
AND CAMPO30 <> 0
GROUP BY campo1, campo2, campo76, campo78, campo11 ,
campo8, campo13, campo30
此转换回复了我这个错误
转换varchar值时转换失败&#39; AAT Rate&#39;到数据类型int。
有什么问题?
提前致谢
答案 0 :(得分:0)
只有流行的东西是大写字母AS和相同的列别名(默认情况下mysql不区分大小写)。 你能这样试试吗?
select campo1 as AGR_Number, campo2 as fattura,
campo76 as cod_periodo, campo78 as cod_scenario,
campo11 as origine, campo8 as Stazione,
campo13 as agent, campo30 as AAT_RATE,
sum (cast(campo30 as numeric (9,2))) as AAT_rate_sum
from map_dati_trasformati
where cod_mappatura = 'CARICA_NOL_CSV'
AND CAMPO30 <> 0
GROUP BY campo1, campo2, campo76, campo78, campo11 ,
campo8, campo13, campo30