Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select and sum
Message
From
19/06/2005 15:19:18
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01024603
Message ID:
01024712
Views:
21
hi,
i try again,
GROUP BY 1,2 && Command is missing required clause

? m1_m && variable is not found
SELECT divi, mac1, ;
	SUM(IIF(MONTH(dat)=1 AND typ = 1, VAL(LEFT(true,2))*3600 + ;
	VAL(SUBSTR(true,4,2))*6+ 	VAL(RIGHT(true,2)) ,0000)) AS m1_m, ;
	SUM(IIF(MONTH(dat)=1 AND typ = 2, VAL(LEFT(true,2))*3600 + ;
	VAL(SUBSTR(true,4,2))*60 + ;
	VAL(RIGHT(true,2)), ;
	0000)) AS m1_a, 	 ;
	SUM(IIF(MONTH(dat)=2 AND typ = 1, VAL(LEFT(true,2))*3600 + ;
	VAL(SUBSTR(true,4,2))*6+ 	VAL(RIGHT(true,2)) ,0000)) AS m1_m, ;
	SUM(IIF(MONTH(dat)=2 AND typ = 2, VAL(LEFT(true,2))*3600 + ;
	VAL(SUBSTR(true,4,2))*60 + ;
	VAL(RIGHT(true,2)), ;
	0000)) AS m1_a, 	 ;		
FROM table1 ;
WHERE dat BETWEEN ("01/01/2005") AND ("31/12/2005") ;
GROUP BY 1,2 && Command is missing required clause 

? m1_m  && variable is not found
>I explained in my previous mesage that 'true2sec' doesn't exist. To make pseudo code simplier I used it instead of 'true' converted to the seconds. You've the code to do that already. Replace 'true2sec' with
VAL(LEFT(true,2))*3600 + ;
>	VAL(SUBSTR(true,4,2))*60 + ;
>	VAL(RIGHT(true,2))
>* or simpler
>INT(CTOT(true) - CTOT("00:00"))
>
>>hi,
>>i get error mesage sql:column'true2sec'is not found
>>
>>SELECT divi, mac1, ;
>>	SUM(IIF(MONTH(dat)=1 AND typ = 1, true2sec, 000000)) AS m1_m, ;
>>	SUM(IIF(MONTH(dat)=1 AND typ = 2, true2sec, 000000)) AS m1_a, ;	
>>	SUM(IIF(MONTH(dat)=2 AND typ = 1, true2sec, 000000)) AS m2_m, ;
>>	SUM(IIF(MONTH(dat)=2 AND typ = 2, true2sec, 000000)) AS m2_a ;	
>>FROM table1 ;
>>WHERE dat BETWEEN ("01/01/2005") AND ("31/12/2005") ;
>>GROUP BY 1,2
>>? m1_m,m1_a
>>? m2_m,m2_a
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform