用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1482|回复: 3
收起左侧

[HELP] $this->db->get('t_account')

[复制链接]
发表于 2015-3-4 09:59:02 | 显示全部楼层 |阅读模式
我在用CI操作数据库时报以下错误,有人知道怎么解决吗?
A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM (`t_account`) WHERE `userId` = '10001' GROUP BY `type`' at line 2

SELECT date_format(createTime, `'%x')` as year, date_format(createTime, `'%v')` as week, SUM(`money`) AS money FROM (`t_account`) WHERE `userId` = '10001' GROUP BY `type`

Filename: /data/home/jd/Project/JdManager/server/models/maccount/account_model.php

Line Number: 136
发表于 2015-3-4 10:07:35 | 显示全部楼层
請貼上第 136 行那個區塊的方法全代碼
並附註你注入的參數為何
发表于 2015-3-4 13:03:04 | 显示全部楼层
使用了group by以后,createTime就不能用了吧?只能使用group by 里的字段和聚类函数,比如sum求和,avg求平均值,count求计数这些。

本版积分规则