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.
| Author |
Topic |
|
scantoria
Starting Member
15 Posts |
Posted - 2009-12-29 : 17:44:45
|
| How do I get the tickets where due date is < now.SELECT COUNT(id) AS PassDueCount, [Due Date]FROM vwTicketsWHERE ([Due Date] < "todays date")Stephen Cantoriascantoria@msn.com |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-29 : 19:00:56
|
| SELECT COUNT(id) AS PassDueCount, [Due Date]FROM vwTicketsWHERE ([Due Date] < DATEADD(d,datediff(d,0,getdate()),0)JimEveryday I learn something that somebody else already knew |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-12-30 : 04:08:35
|
| Addendum:jimf's posted method gets everything from before the start of "today" so from all day yesterday and before. The DATEADD portion strips the time information from the GETDATE() function.If you wanted to get tickets from before now then you just needWHERE [Due Date] < GETDATE()Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
scantoria
Starting Member
15 Posts |
Posted - 2010-01-07 : 14:04:21
|
Thank you so much! This is very helpful.Stevequote: Originally posted by jimf SELECT COUNT(id) AS PassDueCount, [Due Date]FROM vwTicketsWHERE ([Due Date] < DATEADD(d,datediff(d,0,getdate()),0)JimEveryday I learn something that somebody else already knew
Stephen Cantoriascantoria@msn.com |
 |
|
|
scantoria
Starting Member
15 Posts |
Posted - 2010-01-07 : 14:05:09
|
Thank you so much! This is very helpful and thank you for explaning the syntax.Stevequote: Originally posted by Transact Charlie Addendum:jimf's posted method gets everything from before the start of "today" so from all day yesterday and before. The DATEADD portion strips the time information from the GETDATE() function.If you wanted to get tickets from before now then you just needWHERE [Due Date] < GETDATE()Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Stephen Cantoriascantoria@msn.com |
 |
|
|
|
|
|
|
|