首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

大家来找茬.该怎么解决

2013-04-26 
大家来找茬...有两个sql语句,我写的是一样的,可是为什么执行出来的结果不一样啊,找得好晕啊select top 5a.

大家来找茬...
有两个sql语句,我写的是一样的,可是为什么执行出来的结果不一样啊,找得好晕啊


select top 5  a.Action_ID,a.[User_ID], a.Total_Score ,b.Action_Desp, b.CreateTime , b.Point_Change 
   from  tbl_Action_Hist b inner join tbl_Record_Score a on a.Action_ID=b.Action_ID  where 
 a.Action_ID not in (select top (5 * (1 -1)) a.Action_ID from  tbl_Action_Hist b ) 
 and b.Student_ID='100003' and b.Point_Change like '-%'  
 and b.CreateTime between '2013-4-11' and  '2014-4-15'


 select top 5  a.Action_ID,a.[User_ID], a.Total_Score,b.Action_Desp,b.CreateTime , b.Point_Change 
    from tbl_Action_Hist b inner join tbl_Record_Score a  on  a.Action_ID=b.Action_ID  where
  a.Action_ID not in (select top(5 * (1 -1)) a.Action_ID from  tbl_Action_Hist b ) 
 and b.Student_ID='100003' and b.Point_Change like  '-%'  
 and b.CreateTime  between '2013-4-11' and  '2013-4-15'

[解决办法]
最后的 2014 2013

[解决办法]
b.CreateTime  between '2013-4-11' and  '2013-4-15'

后面的日期,一个是2013,一个是2014

热点排行
Bad Request.