|
From: danmarc92 on 2 Jul 2008 11:27 Does anybody have a good code for defining records to those within 1 year. We have a field (closingdate) and so we need to show all records for up to 1 year after their closingdate. Thanks
From: Eric Isaacs on 2 Jul 2008 11:42 WHERE tablename.closingdate >= DATEADD(d, -366, CURRENT_TIMESTAMP) -Eric Isaacs
From: Plamen Ratchev on 2 Jul 2008 11:50 Here is one way: SELECT <columns> FROM Foo WHERE closingdate >= DATEADD(YEAR, -1, DATEADD(DAY, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP), 0)); HTH, Plamen Ratchev http://www.SQLStudio.com
From: danmarc92 on 3 Jul 2008 04:33 Thanks for your help, the querues given do work but I actually need to restrict the records to a year from the closingdate, not a year from current date, does anyone know how to achieve this?. Thanks "Plamen Ratchev" wrote: > Here is one way: > > SELECT <columns> > FROM Foo > WHERE closingdate >= DATEADD(YEAR, -1, > DATEADD(DAY, DATEDIFF(DAY, 0, > CURRENT_TIMESTAMP), 0)); > > HTH, > > Plamen Ratchev > http://www.SQLStudio.com >
From: Plamen Ratchev on 3 Jul 2008 08:14 Please provide table structure, inserts for sample data and expected results. It is not clear from your notes what you really need. HTH, Plamen Ratchev http://www.SQLStudio.com
|
Next
|
Last
Pages: 1 2 Prev: Performance of application ? Next: Time when automatic file growth occurs |