Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select and sum
Message
De
20/11/2004 12:57:04
 
 
À
20/11/2004 12:20:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00963216
Message ID:
00963221
Vues:
9
i need to get all bills numbers and the sum for every bill aloan.
via select customer name and date between 2 dates.
SELECT bill_no, customer_name, SUM( detail_line.amount ) AS bill_total ;
  FROM bill_details JOIN bill_header ON bill_details.bill_no = bill_header.bill_no ;
                    JOIN Customer ON bill_header.customer_no = Customer.Customer_no ; 
WHERE between( bill_header.bill_date, dStart, dEnd ) AND Customer.Customer.no = SomeValue ;
GROUP BY bill_no, customer_name into cursor csrBill Totals
will give you all the bills for a specific customer in a particular date range. If you want all customers for that date range, modify the query like this:
SELECT bill_no, customer_name, SUM( detail_line.amount ) AS bill_total ;
  FROM bill_details JOIN bill_header ON bill_details.bill_no = bill_header.bill_no ;
                    JOIN Customer ON bill_header.customer_no = Customer.Customer_no ; 
WHERE between( bill_header.bill_date, dStart, dEnd ) ;
GROUP BY bill_no, customer_name into cursor csrBill Totals
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform