Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 HELP WITH COUNT QUERY

Author  Topic 

luzner
Starting Member

2 Posts

Posted - 2007-07-31 : 08:40:47
I have the following sql query :

osql -U sa -P test -d TESTDSN -Q "SELECT COUNT(*) FROM SEOSDATA where LOGNAME = 'CPlog'"

How can I change the query to get the only events from the last 24 hours and not count of all events ?

Thanks!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-31 : 08:46:37

Try

osql -U sa -P test -d TESTDSN -Q "SELECT COUNT(*) FROM SEOSDATA where LOGNAME = 'CPlog' and datecol>=Dateadd(hour,-24,getdate())"


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

luzner
Starting Member

2 Posts

Posted - 2007-07-31 : 09:05:59
Thanks it's working great!
Go to Top of Page
   

- Advertisement -