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 2005 Forums
 Transact-SQL (2005)
 Selecet query get rows which are due in 10 days

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2008-10-06 : 16:23:52
I need a select query to get all records which has duedate less than 10 days.
********************************************************************
select * from TAB_ccsNetOrders where duedate = less than 10 days from getdate()

********************************************************************

Thank you for the help.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-06 : 16:26:54
SELECT * FROM TAB_ccsNetOrders where duedate >= DATEDIFF(DAY, 10, getdate())



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-06 : 16:27:48
SELECT * FROM TAB_ccsNetOrders where duedate between getdate() and DATEadd(DAY, 10, getdate())



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-07 : 00:29:47
[code]SELECT * FROM TAB_ccsNetOrders where duedate between DATEADD(dd,DATEDIFF(dd,0,getdate()),0) and DATEADD(ms,-3,DATEADD(dd, DATEDIFF(dd,0,getdate())+11,0))[/code]

just in case you want include records from start of today to end of 10th day
Go to Top of Page
   

- Advertisement -