本文介绍了我可以在mysql中使用聚合函数(LAST)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在mysql中使用聚合函数(LAST)吗? 如果是,那么为什么给我以下查询错误:
can i use aggregation function (LAST) in mysql?? if yes then why give me error for following query::
SELECT `user_id`,last(`value`) FROM `My_TABLE` group by `user_id`错误 ::您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册以获取正确的语法,以在第1行的'(value)FROM My_TABLE group by user_id'附近使用
ERROR:: 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 '(value) FROM My_TABLE group by user_id' at line 1
编辑 ::我得到的答案是最后一个"未在MySql中使用.那么如何在MySql中执行呢?
EDIT:: I got answer "last" is not used in MySql. then How to perform it in MySql??
推荐答案不,在mysql中没有所谓的LAST
No, There is nothing called LAST in mysql
请参见聚合函数的列表
编辑
您可以执行类似的操作
select f.user_id, f.value from ( select MAX(value) as maxval from my_table group by user_id ) as x inner join my_table as f on f.value = x.maxval更多推荐
我可以在mysql中使用聚合函数(LAST)吗?
发布评论