sql语句中同一个表中的几条数据实现相加

来源:百度知道 编辑:UC知道 时间:2024/06/18 15:03:42
String hql = "update Fee as i set i.ysfee=i.transportfee+i.packfee+i.loadfee+i.premium+i.otherfee+i.stockfee";请问这样写对吗

不太对.
String hql = "update i set i.ysfee=i.transportfee+i.packfee+i.loadfee+i.premium+i.otherfee+i.stockfee FROM Fee as i ";

就这个语句来说,as i 和 i.都去掉就没有问题了。
加上它们实在没有必要,也没试过。