Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What wrong with this SQL?
Message
 
À
27/05/2001 10:39:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00511889
Message ID:
00511894
Vues:
23
Hello John,

You can only do group by on existing columns in the resulting cursor. So this means your sql statement should look something like this:
SELECT MONTH(rptDT) as grpMonth, YEAR(rptDT) as grpYear, SUM(HourReq) as sumHourReq, SUM(HourUsed) as sumHourUsed, SUM(HourOT) as sumHourOT, SUM(ManPower) as sumManPower ; 
FROM tblRequest ;
GROUP BY grpYear,grpMonth ;
INTO CURSOR csr
Also, I used the sum() to sum all hours by group, (see the VFP help for all other functions that can be used this way in a sql-select statement) If you don't use this, vfp will show you the value of a record but I wouldn't program it this way because there is no way to know which record is used. It could change in a next version of vfp. As a matter of fact, you must use a function like sum() for all non-grouped fields if you want to use the same sql statement in SQL Server.

hth,
Frank Camp
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform