这种语句怎么写 Select NO From 表 Where InsTime In (Select Max(InsTime) From 表 Group By Client) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select nofrom t awhere instime=(select top 1 instime from t where client=a.client order by instime desc) select nofrom t awhere not exists(select 1 from t where client=a.client and instime>a.instime) 按时间分组,GRUOP BY 然后MAX就可以了 select nofrom t awhere not exists(select 1 from t where client=a.client and instime>a.instime) 这种情况,如果刚好Client:SD与SH的InsTime存在完全相同的话,就可能会多出数据来? 用这个试了么??? 不会重复的 select nofrom t awhere not exists(select 1 from t where client=a.client and instime>a.instime) NO Client InsTime------------------------------------------ No1 SD 2004-11-01 NO2 SH 2004-11-01 NO3 SH 2004-11-02 NO4 SD 2004-11-01你用这个试,就出来3条 select nofrom t awhere no=(select top 1 no from t where client=a.client order by instime desc) SQL复杂ID自动增长问题 请问一个语句 菜鸟,问个问题=送分~~ 查询三个值,删除所有符合条件的。 数据库里面的表如何新增一列 <進倉-出倉=庫存> sql2000中查询存储过程 菜鸟问题一问?(送分题)Online,马上结贴 有开发过外贸系统的高手请进 如何恢复数据库 怎样在表中随机选择5个记录?(急,在线等) 求助各位大哥了!
from t a
where instime=(select top 1 instime from t where client=a.client order by instime desc)
from t a
where not exists(select 1 from t where client=a.client and instime>a.instime)
from t a
where not exists(select 1 from t where client=a.client and instime>a.instime)
select no
from t a
where not exists(select 1 from t where client=a.client and instime>a.instime)
------------------------------------------
No1 SD 2004-11-01
NO2 SH 2004-11-01
NO3 SH 2004-11-02
NO4 SD 2004-11-01
你用这个试,就出来3条
from t a
where no=(select top 1 no from t where client=a.client order by instime desc)