+ -
当前位置:首页 → 问答吧 → 一SQL语句的头痛问题

一SQL语句的头痛问题

时间:2011-07-26

来源:互联网

select code,goods_name,sum(quantity) as zje from buy_goods_list group by code
如上语句在MySQL-Front里运行通过
可我放在软件里运行如下就会提示多步操作错误
 strSql = "select code,goods_name,sum(quantity) as zje from buy_goods_list group by code "
  Set rs = New ADODB.Recordset
  With rs
  .CursorLocation = adUseClient
  .CursorType = adOpenDynamic
  .Open strSql, conn, , , adCmdText
  End With
关键是在sum(quantity) as zje 这句,去掉又会运行正常,谢谢知道问题是出在哪?quantity字段为INT 我想得到相同CODE的数值总和,为什么会执行不了,大家帮我看看

作者: yejian520   发布时间: 2011-07-26

"select `code`,goods_name,sum(quantity) as zje from buy_goods_list group by `code` "

作者: ACMAIN_CHM   发布时间: 2011-07-27