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 |
sambrown18
Starting Member
14 Posts |
Posted - 2008-04-22 : 10:34:43
|
I have posted about this problem before and some solutions were given but i could not make them work. I have an attribute of "date of last service"I need a code that will work out what "dates of last service" are over a year old from todays date.What codes are useful i tried using DateDiff but could not think of how to use it as i am new to SQL |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-22 : 10:39:14
|
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx E 12°55'05.25"N 56°04'39.16" |
 |
|
sambrown18
Starting Member
14 Posts |
Posted - 2008-04-22 : 10:46:45
|
erm was hoping for some code examples not a link |
 |
|
sambrown18
Starting Member
14 Posts |
Posted - 2008-04-22 : 10:54:40
|
i now have two dates to use i have a date of last service and date of next service. i need to find out what instruments will not have been serviced for a year by the time of the next service |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-22 : 10:54:47
|
SELECT * FROM TableWHERE Col1 < DATEADD(YEAR, -1, GETDATE()) E 12°55'05.25"N 56°04'39.16" |
 |
|
sambrown18
Starting Member
14 Posts |
Posted - 2008-04-22 : 11:02:18
|
it does not seem to like th GETDATE statement? |
 |
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2008-04-22 : 11:10:40
|
It? What tool are you using?Ryan Randall Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
sambrown18
Starting Member
14 Posts |
Posted - 2008-04-22 : 11:11:31
|
could i not use a code with DATEDIFF and find any attributes that have a difference of over 365 days between "date of last service" and "next service"? |
 |
|
sambrown18
Starting Member
14 Posts |
Posted - 2008-04-22 : 11:15:39
|
im using Access why? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-22 : 13:44:00
|
quote: Originally posted by sambrown18 im using Access why?
You are posting in wrong forum. This is SQL server forum. |
 |
|
|
|
|