Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select and sum
Message
 
 
To
20/06/2005 02:14:44
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:
01024801
Views:
18
There're many ways to convert seconds to HH:MM:SS format. Try
...
	Sec2Str(SUM(IIF(MONTH(dat)=1 AND typ = 1, INT(CTOT(true) - CTOT("00:00")), 000000))) AS m1_m, ;
	Sec2Str(SUM(IIF(MONTH(dat)=1 AND typ = 2, INT(CTOT(true) - CTOT("00:00")), 000000))) AS m1_a, ;	
...

...
FUNCTION Sec2Str
LPARAMETERS tnSeconds
RETURN TRANSFORM( RIGHT( TTOC(CTOT("00:00") + tnSeconds,1), 6), "@R 99:99:99")

>thank you very much, it works but...
>i need to change  seconds to hours and minuts inside the code
>how i can sum m1_m,m2_m ....m12_m to new field
>and sum  m1_a, m2_a.........m12_1 to new filed
><pre>
>CLOSE all
>USE table1
>INDEX ON  divi TO kk
>m.dat1=ctod("01/01/2005")
>m.dat2=ctod("01/31/2005")
>SELECT divi, mac1, ;
>	SUM(IIF(MONTH(dat)=1 AND typ = 1, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m1_m, ;
>	SUM(IIF(MONTH(dat)=1 AND typ = 2, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m1_a, ;	
>	SUM(IIF(MONTH(dat)=2 AND typ = 1, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m2_m, ;
>	SUM(IIF(MONTH(dat)=2 AND typ = 2, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m2_a, ;	
...
>    SUM(IIF(MONTH(dat)=11 AND typ = 1, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m11_m, ;
>	SUM(IIF(MONTH(dat)=11 AND typ = 2, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m11_a, ;	
>	SUM(IIF(MONTH(dat)=12 AND typ = 1, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m12_m, ;
>	SUM(IIF(MONTH(dat)=12 AND typ = 2, INT(CTOT(true) - CTOT("00:00")), 000000)) AS m12_a ;	
>FROM table1 ;
>WHERE dat BETWEEN m.dat1 and m.dat2 ;
>GROUP BY 1,2
>**skip
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform