CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  MS-SQL Server >  基础类

这个sql语句应该如何写?请帮助。(急)在线等待。

楼主wangjiayi(小怡)2003-12-01 09:50:57 在 MS-SQL Server / 基础类 提问

现在我在一个表里存了ip地址和获得这个ip地址的时间。  
  现在我想写一条sql语句,提出这个表中一个ip在10分钟内的个数。  
  如果表名是UserLogInfo_tbl,其中的存ip地址的为userip,获得这个ip地址的时间为  
  usercreatedate.谢谢各位   了。很急。 问题点数:50、回复次数:6Top

1 楼txlicenhe(马可)回复于 2003-12-01 09:59:18 得分 20

 
  select   userip,count(*)   from   UserLogInfo_tbl  
  where   usercreatedate   between   dateadd(minute,-10,getdate())   and   getdate()  
  group   by   userip  
  Top

2 楼klan(因帅被判7年)回复于 2003-12-01 09:59:44 得分 0

select   count(*)   from   UserLogInfo_tbl   where   userip='10.10.1.1'   and   datediff(mi,usercreatedate,getdate())<10Top

3 楼dlpseeyou(豆子)回复于 2003-12-01 10:04:12 得分 0

select   userip   userip,count(userip)   数目   from   UserLogInfo_tbl  
  where   usercreatedate   between   dateadd(minute,-10,getdate())   and   getdate()  
  group   by   useripTop

4 楼sunshareforever(阳光)回复于 2003-12-01 10:04:38 得分 0

select   count(*)   as     个数   from   UserLogInfo_tbl   where   userip   =   ''   and    
  usercreatedate   >=   convert(convert(usercreatedate,int)-10,datetime)Top

5 楼victorycyz(--)回复于 2003-12-01 10:04:43 得分 30

 
   
  select   count(*)   from   userloginto_tbl   where   usercreatedate   between   @starttime   and   @endtimeTop

6 楼zjcxc(邹建)回复于 2003-12-01 11:08:29 得分 0

 
  select   ip,count(*)   from   UserLogInfo_tbl  
  where   datediff(minute,usercreatedate,getdate())<=10  
  group   by   ipTop

相关问题

  • sql语句问题,等待……
  • SQL 语句。。等待中
  • SQL 语句 - 请帮助
  • 菜 SQL 语句 ,在线等待!!
  • 急!这个sql语句,在线等待
  • sql语句问题。在线等待
  • sql语句问题(在线等待)
  • 求救SQL语句,在线等待
  • 求救SQL语句,在线等待
  • 求救SQL语句,在线等待

关键词

  • 语句
  • ip
  • sql
  • usercreatedate
  • userloginfo
  • tblwhere
  • userip
  • getdate
  • datediff
  • 表

得分解答快速导航

  • 帖主:wangjiayi
  • txlicenhe
  • victorycyz

相关链接

  • SQL Server类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo