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 |
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-07-15 : 09:14:14
|
Hello ALL,i have this query which pulls the data i needselect a.pr_no, a.wi, b.ho_wi from COUNTY as a inner join HOSPITAL as bon a.pr_no = b.ho_numwhere year(a.eff_end) = 2045 and year(b.ho_eff_end) = 2045 and a.wi <> b.ho_wi i want to update the b.ho_wi with a.wi wherever they are different for the years in 2045 in table HOSPITALThanks |
|
vision.v1
Yak Posting Veteran
72 Posts |
Posted - 2010-07-15 : 10:21:25
|
quote: Originally posted by jayram11 Hello ALL,i have this query which pulls the data i needselect a.pr_no, a.wi, b.ho_wi from COUNTY as a inner join HOSPITAL as bon a.pr_no = b.ho_numwhere year(a.eff_end) = 2045 and year(b.ho_eff_end) = 2045 and a.wi <> b.ho_wi i want to update the b.ho_wi with a.wi wherever they are different for the years in 2045 in table HOSPITALThanks
Try below code:UPDATE a SET b.ho_wi = a.wi from COUNTY as ainner join HOSPITAL as bon a.pr_no = b.ho_numwhere year(a.eff_end) = 2045 and year(b.ho_eff_end) = 2045 and a.wi <> b.ho_wi |
 |
|
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-07-15 : 18:34:49
|
thanks it worked..update a should be update b |
 |
|
|
|
|