求一段SQL语句 本帖最后由 jack803 于 2010-08-08 09:23:05 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from tb a where not exists(select 1 from tb where datediff(month,a.dt,dt)=0 and a.dt<dt) select * from tb a where not exists(select 1 from tb where datediff(month,a.dt,dt)=0 and year(a.dt)=year(dt) and a.dt<dt) select * from tb a where dt=(select max(dt) from tb where datediff(month,a.dt,dt)=0 ) 有点难度那位给我看下 难! 怎样得到SQL返回结果的第N行? 关于一个触发器的写法 [SQL] 请问如何多次显示同一条记录 求一sql语句 请问在一个字符串中怎样得到指定子串 急紧求助! 急求一条高难度SQL,大家来讨论 请问!如何取得sql server中表中各表的字段说明??? 如何取查询返回值? datetime复制给另一个datetime无效的情况 一个头痛的SQL语句
where not exists(select 1 from tb where datediff(month,a.dt,dt)=0 and a.dt<dt)
where not exists(select 1 from tb where datediff(month,a.dt,dt)=0 and year(a.dt)=year(dt) and a.dt<dt)
where dt=(select max(dt) from tb where datediff(month,a.dt,dt)=0 )