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:
01531747
Vues:
53
Hi Randy,

Try this...
SELECT LEFT(Dtyme,10) AS Dtyme, AVG(DCreading) AS DCreading, ;
	SPACE(10) AS cDate, SPACE(8) AS cHourMin ;
FROM CPdata  WHERE RType=[DC] ;
	GROUP BY LEFT(Dtyme,10), SPACE(10), SPACE(8)  ORDER BY LEFT(Dtyme,10) ;
	INTO CURSOR CPchart  READWRITE
MartinaJ

>Hello All,
>
>I have a datalogger that 'sends me' the readings in a .CSV file, and this is how I convert it to a FoxPro table/cursor with the intention of using FoxCharts to display the results.
>
>
>CREATE CURSOR CPdata ( ;
>	RType C(24), ;
>	Dtyme C(20), ;
>	MilliSec N(12,4), ;
>	ExcelTyme N(16,8), ;
>	DCreading N(16,7), ;
>	DCunit C(2), ;
>	ACreading N(16,7), ;
>	ACunit C(2), ;
>	TempRead N(6,1), ;
>	TempUnit C(2), ;
>	BattPot N(4,1), ;
>	GPSLat N(12,8), ;
>	GPSLon N(12,8), ;
>	GPSSat N(4), ;
>	CPNote C(48) )
>SELECT CPdata
>cCPdataFyle = [C:\TEMP\UDL1_DATA\TESTDATA.CSV]
>APPEND FROM (cCPdataFyle)  TYPE CSV
>BROWSE  TITLE cCPdataFyle
>
>This part of the code works just as I expect it should.
>The challenge is the quantity of data that is being saved and therefore must be displayed on the chart - 1 reading per second. 3600 readings per hour, 86400 per day. I'm trying to distill the data by averaging 10 readings into 1 number for display purposes using a SQL select:
>
>SELECT LEFT(Dtyme,18) AS Dtyme, AVG(DCreading) AS DCreading, ;
>	SPACE(10) AS cDate, SPACE(8) AS cHourMin ;
>FROM CPdata  WHERE RType=[DC] ;
>	GROUP BY Dtyme, cDate, cHourMin  ORDER BY dTyme ;
>	INTO CURSOR CPchart  READWRITE
>BROWSE  TITLE [Data to Chart]
>
>Problem: No grouping occurs (see attached screenshot).
>
>I'm missing something..... your assistance is appreciated.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform