Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query
Message
De
04/09/2001 11:27:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
04/09/2001 11:22:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Re: Query
Divers
Thread ID:
00552079
Message ID:
00552082
Vues:
14
>I have a file with a large number of employees in different departments, with the department numbers recurring throught the data
>
>I need a summary report by dept which lists total number of employees and total number of hours (another field on every record). I could write a routine to do it but I know_ there has to be a sql statement. Any ideas?
>
>TIA
>CG

How about:
select Department, count(*) as NumEmployees, sum(hours) as TotalHours;
  from MyTable;
  group by Department;
  order by TotalHours descending;
  into cursor Summary
I am assuming you have one record per employee.

GROUP BY will create a single summary record for each department.

HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform