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 |
|
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2008-06-23 : 18:19:40
|
| SELECT * FROM TEST NOLOCKWHERE FY_CD = DATEPART(YEAR, GETDATE())This gives me last years - but they want last years 2007 and 2008Any suggestions |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-23 : 18:26:06
|
| SELECT * FROM TEST NOLOCKWHERE FY_CD >= DATEADD(year,DATEDIFF(year,0,GETDATE())-1,0)MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-23 : 18:28:43
|
| Wait. Are you stroring only year values in FY_CD column?SELECT * FROM TEST NOLOCKWHERE FY_CD >= DATEPART(year,DATEADD(year,-1,GETDATE()))MadhivananFailing to plan is Planning to fail |
 |
|
|
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2008-06-24 : 08:15:39
|
| Yes only year in the fy_cd column..I try it outThanks |
 |
|
|
|
|
|