Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Summing inside a query
Message
 
À
16/02/2001 15:00:15
Erin Eby
Mission Critical Software
Gainesville, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00476784
Message ID:
00476839
Vues:
24
>Hi all...happy Friday!
>
>Here's my question. I am putting together a query from 2 different tables. One of the tables lists the quantity of an item at every location. So, there's a record in that table for Item #123 at Location 1, Item #123 at Location 2, etc. To get the actual quantity on hand for that item, I need to sum all of the records in that table where Item = #123. This total quantity will be one of my columns in my query result. I also need to get a few other fields from another table (also containing the item number). Can I somehow combine my big select statement with this "sum" select statement so I only have one select query for the whole thing? If this makes any sense, TIA.
>
>erin :)

Try with next code:
SELECT Table1.NoItem, Table2.NameItem, ;
   SUM(Table1.Quantity) AS Quantity ;
   FROM Table1 ;
   INNER JOIN Table2 ON Table1.NoItem = Table2.NoItem ;
   GROUP BY NoItem ;
   ORDER BY NameItem ;
   INTO CURSOR MyQuery
Luis María Guayán
Tucumán, Argentina
________________________________
SysOp de www.PortalFox.com
Nada corre como un zorro
________________________________
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform