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 |
matrixrep
Starting Member
30 Posts |
Posted - 2011-12-21 : 15:29:50
|
Here is the problem:SELECT YEAR.*FROM YEAR inner join ORG on YEAR.org = ORG.orgWHERE (getdate() BETWEEN YEAR.DATE_BEG AND YEAR.DATE_END) and getdate() <= '2011-12-25'I need to replace 2011 by an actual field in the table ORG which isORG.ACTUAL_YEAR ans leave the rest as it is.How do i do that ?Any help is deeply appreciated.Season greetings to all |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-12-21 : 15:44:14
|
[code]and getdate() <= CAST(ORG.ACTUAL_YEAR AS VARCHAR(4)) + '-12-25'[/code]or more preferably[code]and getdate() <= CAST(ORG.ACTUAL_YEAR AS VARCHAR(4)) + '1225'[/code] |
|
|
matrixrep
Starting Member
30 Posts |
Posted - 2011-12-21 : 15:54:43
|
Thank you for your help. |
|
|
|
|
|