Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mysql syntax for updating stock qty
Message
De
25/01/2013 03:42:13
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Mysql syntax for updating stock qty
Divers
Thread ID:
01564032
Message ID:
01564032
Vues:
53
I have 2 table in mysql database.

1. Stock having field item_id, qty_stock
2. purchase having field order_no,item_id, qty_purchase

eg :
Stock data : item_id qty_stock
A001 0
A002 0

purchase data : order_no item_id qty_purchase
001 A001 10
001 A002 5
001 A001 3

My Mysql syntax is

"Update purchase a, stock b "+
"set b.qty_stock = b.qty_stock + a.qty_purchase "+;
"Where a.order_noi = '001' and a.item_id = b.item_id"

The result is
A001 3 (which should be 13)
A002 5

Thank you.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform