vfp dbf表用sql语句查询缺少GROUP BY子句
SELECTmingxiSELECTnum,username,spnum,fenzhong,xiaolv,shijian,sum(spnum)aszspnum,sum(f...
SELECT mingxi
SELECT num,username,spnum,fenzhong,xiaolv,shijian,sum(spnum)as zspnum,sum(fenzhong)as zfenzhong FROM mingxi GROUP BY num
其中时间是日期型,其他字段都是字符型
提示缺少GROUP BY子句或无效
在vfp里,sql语句应该也是这样写的吧 展开
SELECT num,username,spnum,fenzhong,xiaolv,shijian,sum(spnum)as zspnum,sum(fenzhong)as zfenzhong FROM mingxi GROUP BY num
其中时间是日期型,其他字段都是字符型
提示缺少GROUP BY子句或无效
在vfp里,sql语句应该也是这样写的吧 展开
2个回答
展开全部
应该是
SELECT num,username,spnum,fenzhong,xiaolv,shijian,sum(spnum)as zspnum,sum(fenzhong)as zfenzhong FROM mingxi GROUP BY num,username,spnum,fenzhong,xiaolv,shijian
所有非聚合值都要Group by
SELECT num,username,spnum,fenzhong,xiaolv,shijian,sum(spnum)as zspnum,sum(fenzhong)as zfenzhong FROM mingxi GROUP BY num,username,spnum,fenzhong,xiaolv,shijian
所有非聚合值都要Group by
更多追问追答
追问
按你的改了,但提示sql:对非数值表达式进行合计操作。
追答
也就是说spnum 或者fenzhong 字段不是数值类型?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询