adoquery1.SQL.Text:='select plu.comid,plu.barcode,plu.comname,plu.standards,plu.unit,vendorstock.quantity,stock.quantity from plu,vendorstock,stock where plu.barcode like '''+edit1.Text+''' and plu.comid = vendorstock.comid and plu.comid = stock.comid';
我在edit1里输入6903148010952
注,数据表vendorstock里有6903148010952的数据有4条
格式如下 6903148010952 10
6903148010952 5
6903148010952 15
6903148010952 20
这样一查就得出了4条数据了
小弟只想得出一条,而结果是
6903148010952 50
(50是上面4条数据加起来的和)
请问要如何修改上面的SQL语句
小弟是初学者,还望各位赐教赐教!
在此先行谢过!
我在edit1里输入6903148010952
注,数据表vendorstock里有6903148010952的数据有4条
格式如下 6903148010952 10
6903148010952 5
6903148010952 15
6903148010952 20
这样一查就得出了4条数据了
小弟只想得出一条,而结果是
6903148010952 50
(50是上面4条数据加起来的和)
请问要如何修改上面的SQL语句
小弟是初学者,还望各位赐教赐教!
在此先行谢过!
group by plu.comid,plu.barcode,plu.comname,plu.standards,plu.unit'
////////////
这句错了应该这样写:like ''%'+edit1.text+'%''
select sum(要累加的字段) from table group by plu.barcode你上面的语句自己去加工了呵呵,我就不完整的写出来了
group by plu.comid,plu.barcode,plu.comname,plu.standards,plu.unit'