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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2008-02-18 : 03:18:39
|
| what's the correct way to update fields based on a joinmy current codeupdate usercontacts left join sccontacts on usercontacts.id=sccontacts.usercontactsid left join shoppingcart on shoppingcart.cartitemid=sccontacts.cartitemid set userid=1 where userid is null and shoppingcart.usrsessid='218_78.46122'is not working |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-18 : 03:26:55
|
quote: Originally posted by esthera what's the correct way to update fields based on a joinmy current codeupdate usercontacts left join sccontacts on usercontacts.id=sccontacts.usercontactsid left join shoppingcart on shoppingcart.cartitemid=sccontacts.cartitemid set userid=1 where userid is null and shoppingcart.usrsessid='218_78.46122'is not working
change it like this:-update ucset uc.userid=1 usercontacts uc left join sccontacts scon uc.id=sc.usercontactsid left join shoppingcart scron scr.cartitemid=sc.cartitemid where uc.userid is null and sc.usrsessid='218_78.46122' |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2008-02-18 : 03:36:46
|
| Line 3: Incorrect syntax near 'usercontacts'. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-18 : 04:05:56
|
quote: Originally posted by esthera Line 3: Incorrect syntax near 'usercontacts'.
update ucset uc.userid=1 from usercontacts uc left join sccontacts scon uc.id=sc.usercontactsid left join shoppingcart scron scr.cartitemid=sc.cartitemid where uc.userid is null and sc.usrsessid='218_78. |
 |
|
|
|
|
|