如题,我在网上也找过相关解决方法,很多解答都是这么一句sql语句:
select id,accountid,mark,max(createtime) as latest from accountmark as b group by accountid
使用max函数。但是在我查出来的数据中似乎有些不对,如图,反白的那一条数据,mark字段和createtime字段根本不对应啊!

这是怎么回事?使用max函数后在分组这样靠谱吗?
还有一条语句:select *,count(accountid) as num from
(select * from accountmark order by createtime desc) `temp`
group by accountid order by createtime desc
这样查出来的数据是对的
但是,我需要创建视图,mysql中视图里不允许出现查询子句。求大神些一条sql语句,能实现既不出现子句,又能查出正确数据。谢谢!
解决方法:
安装、修复、更新或打包一个基于 Python 和 PyMySQL 实现的 Windows `mysql` 命令。适用于用户希望在 PowerShell/CMD 中输入 `mysql` 时重定向到 Python 实现、需要交互式输入 MySQL 连接信息、需要同步到当前用户本地 bin 目录,或需要将该能力封装成可公开复用的 Codex skill。
select * from AccountMark as b where not exists(select 1 from AccountMark where AccountId= b.AccountId
and b.CreateTime










