Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Partial Shipment Check Qty left!
Message
De
10/12/1999 23:56:30
 
 
À
10/12/1999 23:39:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00302169
Message ID:
00302176
Vues:
22
Justok,

>>Ok.. So, can I do SQL sth like:

>>Creaet SQL VIEW OrdersLeftQTY As ;
Select Orditems.Order_ID, Orditems.ITEM, Orditems.QTY - SUM(Shipment.SHIPQTY) as LeftQTY... ;
From Orditems Inner Join Shipment On Orditems.OrdIt_ID=Shipment.OrdIt_ID ;
Where OrdItems.Order_ID = ?Thisform.CurOrder_ID ;
Group By Shipment.OrdIt_ID

Well, you might want to change the "Inner Join" to "Left Join" to include Orditems that have NO shipments yet. The Inner Join of course would only give Orditems that have at least 1 shipment.

>>Then, I'd like to known the different btw :
>>Select .... ;
>>Group by Shipment.Order_ID, Shipment.ITEM

The above select would not necessarily give you a unique item. What if the order has 2 lineitems with the same ITEM. Which one does the shipment apply to?

>>and
>>Select .... ;
>>Group by Shipment.OrdIT_ID

This one ties the shipments directly to a particular line item only. No problem with several line items that have the same ITEM.

>>Or Using SUM, CALCULATE cmd to sum up value and subtract from Orditems.Qty?

Test it both ways and see how it performs. SQL Select, however is more portable if you move to SQL Server in the future. Either way, you need to have an ID on the lineitem which will be a foreign key in the shipment table.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform