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 |
|
wallyk
Starting Member
8 Posts |
Posted - 2006-06-29 : 18:42:38
|
| Is it possible to update an entire column with data from another table? I have allot of information that is date sensative and would rather just update one column rather than havnig to change the date all the time. I have started this string and am stuck about what tp put after the SET stringUPDATE scf_yfeesycomSET netrealpl =SELECT netrealplFROM scf_pandlWhere date > 2006-01-31 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-06-29 : 18:48:08
|
You need to do something like:UPDATE titles SET ytd_sales = titles.ytd_sales + sales.qty FROM titles, sales WHERE titles.title_id = sales.title_id AND sales.ord_date = (SELECT MAX(sales.ord_date) FROM sales) This is a Books Online example. Check out the page on UPDATE |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-30 : 02:03:24
|
| Something likeUPDATE TSET netrealpl =S.netrealplFROM scf_yfeesycom T inner join scf_pandl Son T.keycolumn=S.keycolumnWhere S.date > '2006-01-31'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|