|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I have two tables: product_table and synnex. I want to update the weight field in product_table with the shipping_weight field in synnex. I only want to update the fields where product_table.sku = synnex.sku. How do I do this? Thanks in advance for your help
|
|
#2
|
|||
|
|||
|
try this:
update product_table set weight = syn.shipping_weight from synnex syn where syn.sku = product_table.sku |
|
#3
|
|||
|
|||
|
I tried this and I get an error message that says I have a missing operator
Quote:
|
|
#4
|
|||
|
|||
|
mmm.. just checked and double checked my syntax and should work perfectly n- please check your syntax again?
|
|
#5
|
|||
|
|||
|
BTW--thanks for your help on this.
I didn't want to mess with my "real" tables so I created two new ones for testing: table_one and table_two Here is the code I inputted and get the syntax error with: update table_one set weight = syn.shipping_weight from table_two syn where syn.sku = table_one.sku Please advise...thanks! Quote:
|
|
#6
|
|||
|
|||
|
If your table names are 'table_one' and 'table_two', this 'should' do it:
update table_one set weight = t2.shipping_weight from table_two t2 where table_one.sku = t2.sku |
|
#7
|
|||
|
|||
|
I finally got it to work with this:
update table_one, table_two set weight = table_two.shipping_weight WHERE table_two.sku=table_one.sku Thanks for your help Quote:
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Update table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|