求一句SQL,在线等待,马上结帖!!!!!!! Select * from 表 a where time = ( Select max(time) from 表 where users = a.users) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Select * from 表 a where time in ( Select max(time) from 表 where users = a.users) select users ,stutus ,max(time) lasttime from table_name Select * from 表 a where not exists( Select 1 from 表 where time>a.time and users = a.users) select * from 表 a where time=(select max(time) from 表 where users=a.users)是对的。 select * from 表 a join(select users ,max(time) time from 表 group by users) bon a.users = b.users and a.time = b.time 请问你 一个用户最后一个字段是唯一的吗如果不是 那么一个用同一天活动两次 是不是出现重复记录那time字段 是不是应该改成2003-9-9 12:12:00 否则很容易出现重复记录 且不能用max(time) 来回答你的问题 MSSQL2000行转列 一个困扰多时的sql,求助 存储过程如何分页 这个sql语句不会写,求救 求助:一个简单的sql语句怎么写? 附加数据库显示948错误.. question~~~~~~~~ 一个SQL update更新问题(更新表的多个字段值从另一张表的多个记录里抓) 字符替换的问题 ?sql server 2008 如何导入tdms格式的数据? 问专家:跨库执行查询的性能问题! 请教关于触发器问题
where time in ( Select max(time) from 表 where users = a.users)
where not exists( Select 1 from 表 where time>a.time and users = a.users)
(select users ,max(time) time from 表 group by users) b
on a.users = b.users and a.time = b.time
如果不是 那么一个用同一天活动两次 是不是出现重复记录那
time字段 是不是应该改成2003-9-9 12:12:00
否则很容易出现重复记录 且不能用max(time) 来回答你的问题