Thanks for all the replies. I did originally have the two dates around
the other way, and I had -24 instead of 24, but changed it as I couldn't
get it working. Here are a sample of the records in the db that should
be returning results:

pkAttempt       dtAttempt                       
10005           20/02/2002 11:26:05 AM  
10006           20/02/2002 11:26:14 AM  
10007           20/02/2002 11:39:52 AM  
        
But this query returns no results (through Query Analyser):

SELECT  Attempt.pkAttempt,
                Attempt.dtAttempt
FROM            Attempt
WHERE           Attempt.dtAttempt BETWEEN GETDATE() AND
DATEADD(hh,-24,GETDATE())       

I don't know what else to try! I don't suppose it could be some kind of
regional settings problem (Australian)?

Thanks,
Kay.
______________________________________________________ 
Kay Smoljak - ColdFusion Developer - PerthWeb Pty Ltd 
  
Level 9/105 St George's Terrace - Perth - Western Australia 
Ph: (08) 9226 1366 Fax: (08) 9226 1375 www.perthweb.com.au

http://developer.perthweb.com.au - Tools for Developers
cfx_pwcamtech | cfx_pwimageproc | cfx_pwcardcyrpt
                

 
 

> -----Original Message-----
> From: webdiva [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, 19 February 2002 2:00 PM
> To: SQL
> Subject: RE: BETWEEN and date functions
> 
> 
> shouldn't it be -24 otherwise you are looking for
> anything between now and 24 hours FROM now which would
> not pull any results.
> Kelly
> 
> -----Original Message-----
> From: Kay Smoljak [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 11:04 PM
> To: SQL
> Subject: BETWEEN and date functions
> 
> 
> Hi all,
> 
> I have the following query, trying to pull out login attempts 
> that have occurred within the past 24 hours:
> 
> SELECT        attempt.pkAttempt
> FROM          attempt
> WHERE         attempt.ipaddress = '#cgi.remote_addr#'
> AND           attempt.type = '#attributes.type#'
> AND           attempt.dtAttempt 
> BETWEEN       DATEADD(hh,24,GETDATE())        
> AND           GETDATE()        
> 
> It's not throwing an error, but it's not returning results 
> that it definitely should be, either. Can anyone see where 
> I'm going wrong? (SQL Server 2000)
> 
> Thanks,
> Kay.
> ______________________________________________________ 
> Kay Smoljak - ColdFusion Developer - PerthWeb Pty Ltd 
>   
> Level 9/105 St George's Terrace - Perth - Western Australia 
> Ph: (08) 9226 1366 Fax: (08) 9226 1375 www.perthweb.com.au
> 
http://developer.perthweb.com.au - Tools for Developers cfx_pwcamtech |
cfx_pwimageproc | cfx_pwcardcyrpt
                

 
 


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to