一道vfP程序题 alter table order add column 总金额 N(7,2)close alluse ordergo topdo while not eof() sele sum(orderitem.数量*goods.单价) from orderitem,goods where;orderitem.商品号=goods.商品号 and orderitem.订单号 =order.订单号

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 04:26:44
一道vfP程序题 alter table order add column 总金额 N(7,2)close alluse ordergo topdo while not eof() sele sum(orderitem.数量*goods.单价) from orderitem,goods where;orderitem.商品号=goods.商品号 and orderitem.订单号 =order.订单号

一道vfP程序题 alter table order add column 总金额 N(7,2)close alluse ordergo topdo while not eof() sele sum(orderitem.数量*goods.单价) from orderitem,goods where;orderitem.商品号=goods.商品号 and orderitem.订单号 =order.订单号
一道vfP程序题
alter table order add column 总金额 N(7,2)
close all
use order
go top
do while not eof()
sele sum(orderitem.数量*goods.单价) from orderitem,goods where;
orderitem.商品号=goods.商品号 and orderitem.订单号 =order.订单号;
group by 订单号 into array a
replace 总金额 with a(1)
skip
enddo
replace 总金额 with a(1) 换成update order set 总金额=a为什么不行?总金额全部是一个值?

一道vfP程序题 alter table order add column 总金额 N(7,2)close alluse ordergo topdo while not eof() sele sum(orderitem.数量*goods.单价) from orderitem,goods where;orderitem.商品号=goods.商品号 and orderitem.订单号 =order.订单号
你对update用法不是很了解
update order set 总金额=a where ...只有加入条件才能定位到那一条记录,不然就是全部记录被替换了
如果你知道订单号
update order set 总金额=a where 订单号="12345"
就可以了