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 |
simi28
Starting Member
27 Posts |
Posted - 2008-10-02 : 08:38:55
|
Hi,Will the update query work for updating the value in pct column of Table a.Update a Set a. pct=PP. PCT From p,a,pp,ap,ph,ba Where p.pid = a.pid and ap.aid = a.aidand pp.pid = p.pidand ba.bid = p.bidand ph.productid = pp.productidand ph.pdscr = ap.pdscrand pp.pct != ap.pctand pp.pct != 0and ap.pct = 100and pp.pct != a.pctand a.status != 4and p.statusid != 6and year(a.enddate) in (2006,2007,2008,2009)if not then,please let me know what will be the correct synatx for the same.Seema |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-02 : 08:53:44
|
It not?Haven't you tried your code above? E 12°55'05.63"N 56°04'39.26" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-02 : 09:23:50
|
[code]UPDATE yakSET yak.PCT = pp.PCT FROM a AS yakINNER JOIN p ON p.PID = yak.PID AND p.STATUSID <> 6INNER JOIN pp ON pp.PID = p.PID AND pp.PCT <> 0INNER JOIN ap ON ap.AID = yak.AID AND ap.PCT = 100INNER JOIN ph ON ph.PRODUCTID = pp.PRODUCTIDINNER JOIN ba ON ba.BID = p.BIDWHERE AND yak.STATUS <> 4 AND yak.ENDDATE >= '20060101' AND yak.ENDDATE < '20100101' AND ph.PDSCR = ap.PDSCR AND pp.PCT <> ap.PCT AND pp.PCT <> a.PCT[/code] E 12°55'05.63"N 56°04'39.26" |
|
|
|
|
|