MySQL Forums
Forum List  »  Newbie

Re: Table is specified twice
Posted by: Peter Brawley
Date: December 10, 2020 12:09PM

Standard multi-table-reference Update syntax (see the manual page for Update) removes the redundancy ... you didn't post your DDL so I can't test this but something like ...

UPDATE ps_product_shop           ps
  JOIN ps_stock_available        sa ON ps.id_product=sa.id_product 
                                    AND ps.id_shop=sa.id_shop
  LEFT JOIN ps_product_attribute pa ON sa.id_product=pa.id_product
SET ps.active=0, ps.indexed=0
WHERE ps.id_shop=1 
  AND ps.active=1 
  AND pa.id_product_attribute is null 
  AND sa.id_shop=1 
  AND sa.quantity <= 0
);
[/cde]

Options: ReplyQuote


Subject
Written By
Posted
December 10, 2020 03:26AM
Re: Table is specified twice
December 10, 2020 12:09PM
December 12, 2020 07:20AM
December 12, 2020 12:16PM
December 12, 2020 12:34PM
December 12, 2020 02:28PM
December 14, 2020 03:32AM
December 14, 2020 09:00AM
December 14, 2020 11:57AM
December 14, 2020 01:24PM
December 15, 2020 06:57AM
December 15, 2020 11:01AM
December 18, 2020 06:16AM
December 18, 2020 10:59AM
January 06, 2021 06:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.