Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to GROUP BY ....
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Divers
Thread ID:
01531746
Message ID:
01531753
Vues:
30
>That's tricky, especially in VFP (much easier in SQL Server).
>>
>>Ok, try
>>
>>SELECT max(cast (Dtyme as datetime)) AS DateTyme, AVG(DCreading) AS DCreading, ;
>>	SPACE(10) AS cDate, SPACE(8) AS cHourMin ;
>>FROM CPdata  WHERE RType=[DC] ;
>>	GROUP BY ROUND ((cast(dTyme as Datetime) - datetime(1900,1,1,0,0))/10,0) ;
>> ORDER BY LEFT(Dtyme,10) ;
>>	INTO CURSOR CPchart  READWRITE
>>&& round to 10 seconds.
>
>I get this error message: SQL: Column '' is not found. As I said to Martina, anything other than a field name (or field number) in the GROUP BY clause seems to trigger this error.

Simple workaround:
SELECT max(cast (Dtyme as datetime)) AS DateTyme, AVG(DCreading) AS DCreading, ;
	SPACE(10) AS cDate, SPACE(8) AS cHourMin, ROUND ((cast(dTyme as Datetime) - datetime(1900,1,1,0,0))/10,0)  as RoundedSec ;

FROM CPdata  WHERE RType=[DC] ;
	GROUP BY 5 ORDER BY 1 && VFP allows to use numbers in the GROUP BY and ORDER BY
	INTO CURSOR CPchart  READWRITE
>>&& round to 10 seconds.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform