2

I have two tables "basket_products" and "products". I want to update "products" table's "adet" column with "basket_products" "adet" column. And i want to update rows where basket_products.urun = products.urun. I want to use this code and getting error : "The multi-part identifier "basket_products.urun" could not be bound."

update products
    set adet = adet - (
        select basket_products.adet
            from basket_products
                inner join products
               on products.urun = basket_products.urun) 
   where products.urun = basket_products.urun

What's wrong?

M.Ali
  • 67,945
  • 13
  • 101
  • 127
Xaithe
  • 97
  • 1
  • 11

1 Answers1

2

Try this:

update p set p.adet = bp.adet from products p join basket_products bp on p.urun = bp.urun

POK
  • 84
  • 3