November 7, 2011 at 9:24 am
I have two columns
1 appointment
2 joindate
date is like
Appointment | joindate
2008-02-29 00:00:00.000 2008-02-30 00:00:00.000
As per my requirement i have take one day before to join date
Ex :
select * from table where Appointment = onedaybefore (joindate)
November 7, 2011 at 9:26 am
Not exactly sure what you need but either dateadd or datediff functions should get you what you need. check them out on BOL.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
November 7, 2011 at 9:57 am
onedaybefore (joindate) ==> DATEADD(day, -1, joindate)
-- Gianluca Sartori
November 7, 2011 at 6:44 pm
If you want anything that happened since the start of the previous calendar day, rather than during the previous 24 hours, you'll need to do something like:
DATEADD(dd, -1, DATEDIFF(dd,0,joindate))
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply