Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
I want to know how many invoices there are for each company.
select company from invoices into cursor X1
select Company, Cnt(Company)as Invoices from X1 group by 1
select Company, count(Company)as Invoices from X1 group by 1
The above all produce 1 per company even though some comapnies have 100.
select company, 1 as Inv from invoices into cursor X1
select Company, sum(Inv) rom X1 group by 1
Also, produces 1 per company.
Question 1: Why do the above not work?
Question2: How can I get the number of invoices per company with an SQL select?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement