易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL 语句。。 请教高手

先来一个错误语句。。
select * from [aa] where a1 in (select max(a2),a1 from [aa]  group by a1 )


我大体意思,
读取一个统计系统中 不重复的 IP 按照 最后时间排序,并显示出所有字段。。


高手请帮帮忙,,要求一行语句完成。。
SQL code:
select *
from [aa] t
where not exists(select 1 from [aa] where a1=t.a1 and a2>t.a2)


SQL code:
select * from [aa] a where a2 = (select max(a2) from [aa] where a1=a.a1 )


三楼正解。。。

下面语句调试通过:

select * from [aa] where a2 in (select max(a2) from [aa] group by a1)

查询出 不重复的a1 按照 a2 最大值自由 ASC 或 DESC

非常感谢两位高手指点。。

谢谢谢。。。。。。。。。。。。。




相关问答:

如何用c#,sql2000 开发c/s下的工作流?

本人c#新手 可是要求要用c# ,sql2000开发c/s的工作流,一头雾水,请大家帮忙帮忙,给点思路,说的约具体越好,我也好往那个方面去学习
http://www.hxzi.com/view/61402.html
B/S版的,基本思想应该差不多的。。 ......

求助一句SQL语句

数据类型:
Code char(6)
CreateTime datetime
Price float

数据如下:

Code      CreateTime          Price
031021 2008-10-17 15:00:1 ......

sql server 2005 奇怪的问题 关于名字的定位

sql server 2005 触发器 执行sp_executesql 的问题
db1,db2是一个服务器 server 的2个数据库

db1的table1  建立一个after update触发器 ,当 update  table1 后建立一个复制表到  db2的tabl ......

oracle中的to_char,sql server 2005对应的方法是什么

怎么把下面的改成sql server的方法?
to_char(img_comm_metadata.scene_centre_time,'yyyy-mm-dd hh24:mm:ss')>='1990-10-13 09:41:20'
SQL code:
datediff(ss,'1990-10-13 09:41:20',img_ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号