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 |
|
InNomina
Starting Member
40 Posts |
Posted - 2012-05-21 : 18:51:49
|
| I need to take a date column in table 1 and add a number to the years i.e.< TABLE 1-Column A "01/01/1980" + table 2 Column B "6" years = Table 1 Column B "01/01/1986"Not sure how this would be done.-------------------------"If you never fail, you're not trying hard enough" |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-21 : 19:01:03
|
| whats the column by which tables are related? Unless you have a relation, you wont be able to determine which row value needs to added to which row date------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
InNomina
Starting Member
40 Posts |
Posted - 2012-05-21 : 19:20:23
|
| TABLE 2 id is linked to the records in table 1Example:Table 1ID | Date1 | ID of a record in Table 2| Date 2Hope this is clear-------------------------"If you never fail, you're not trying hard enough" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-21 : 19:22:56
|
you mean this?SELECT t1.*,DATEADD(yy,t2.ColB,t1.ColA) AS NewDateFROM table1 t1INNER JOIN Table2 t2ON t2.ID = t1.ID ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
InNomina
Starting Member
40 Posts |
Posted - 2012-05-21 : 19:49:00
|
| I will give that a shot...Thanks!-------------------------"If you never fail, you're not trying hard enough" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-21 : 19:50:47
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|