Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to GROUP BY ....
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01531746
Message ID:
01531750
Views:
35
>>Do you want to group by each hour? If so, GROUP BY LEFT(dType, 13).
>>
>>If you want to group by date only, GROUP BY LEFT(dType,10)

>
>At this point I want to GROUP BY each 10 seconds, i.e. 1/6th of a minute.
>I'm sure that at some point I will want to consolidate larger chunks of data. Thanks for the help.

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.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform