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 |
|
gg0270
Starting Member
2 Posts |
Posted - 2010-02-07 : 05:15:08
|
| Hi, I want to use the SELECT statement to get all my records from my table which is 20 days from the current date. I have been trying all ways but can't get it.. help will be appreciated!SELECT WEIGHT, TIME, USER_IDFROM dbo.WeightTableWHERE (USR_ID = 'abc') AND 'LAST_UPDATED_TIME' >= DATE_SUB(CURDATE(), INTERVAL 15 DAY)i am using ms sql server management studio express.. 2005 version. thanks! |
|
|
gg0270
Starting Member
2 Posts |
Posted - 2010-02-07 : 05:17:28
|
| it says that the curdate function is not a built-in function name. can someone help me to correct statement? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-07 : 10:26:25
|
| the function to get current date value in sql server is GETDATE(). Also there's no function like DATE_SUB in ms sql server. it should beLAST_UPDATED_TIME >= DATEADD(day,-15,GETDATE()) |
 |
|
|
|
|
|