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:
01531756
Views:
28
>>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.

>
>Same error message. I'll have look at this again in a few days- right now I have other commitments. Thanks for your time.

Ok, here is the code that is always going to work:
SELECT max(cast (Dtyme as datetime)) AS DateTyme, AVG(DCreading) AS DCreading, ;
cDate, cHourMin FROM ;
(SELECT dTyme, 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]) X ;
	GROUP BY RoundedSec, cDate, cHourMin ;
                   ORDER BY DateTyme ;
	INTO CURSOR CPchart  READWRITE
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform