MySQL Forums
Forum List  »  Italian

Re: Update con select nel where
Posted by: Claudio Cherubino
Date: October 19, 2007 03:30PM

La tua query non funziona perchè la subquery restituisce una colonna di id_prodotto e non un solo record.
Per far funzionare la tua query e aggiornare tutti i prodotti di una determinata categoria ti basta usare IN invece dell'uguale, in questo modo:

UPDATE tab_listiniprodotti SET listino3 = 1.5*listino3 WHERE id_prodotto IN (SELECT id_prodotto FROM tab_prodotti WHERE cat_prod = 'id_categoria_interessata')

Options: ReplyQuote


Subject
Views
Written By
Posted
36569
October 19, 2007 02:58PM
Re: Update con select nel where
12480
October 19, 2007 03:30PM
8281
October 19, 2007 03:34PM
7446
January 02, 2008 01:22PM
6675
October 19, 2007 03:31PM


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.