ho 3 tabelle
products = dove ci sono i prodotti
categories = dove ci sono le categorie
products_to_categories = tabella che lega insieme le 2 tabelle di sopra
ora vorrei aggiornare il codice dei prodotti di una determinata categoria (che ha il codice 40)
per visualizzare i prodotti della categoria ho fatto la seguente select:
e funzionacodice:select products_copy.products_id, products_copy.products_model, products_to_categories.categories_id from products_copy inner join products_to_categories on products_to_categories.products_id=products_copy.products_id and products_to_categories.categories_id='40'
ora ho provato a fare l'update ma sbaglio qualcosa
e mi da il seguente errorecodice:update products_copy set products_copy.products_model='GO'+products_copy.products_model+1 where products_copy.products_id = any ( select products_copy.products_id as pippo from products_copy inner join products_to_categories on products_to_categories.products_id=products_copy.products_id and products_to_categories.categories_id='40')
ho provato a cercare sucodice:Error Code : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '( select products_copy.products_id as pippo from products_cop (0 ms taken)
http://dev.mysql.com/doc/refman/4.1/en/subqueries.html
ma non ho capito molto
grazie a chi mi aiuterà...


Rispondi quotando
