Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to sum records,HELP
Message
From
16/03/2002 05:30:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00633512
Message ID:
00633714
Views:
19
Which comma Matthew ? There is no comma after 'from myTable'. Would you paste the code that's not working.
Cetin

>Is the comma after the 'SELECT myTable, ;' the trick to making this work? I tried and tried to use SUM() 2 times in the same SELECT with VFP giving me errors about unrecognized command verb and syntax. The only difference I cansee is that comma.
>
>>>Hello all,
>>>
>>>I have one table :
>>>
>>>TABLE.DBF
>>>empno code time
>>>11111 AB 8.00
>>>11111 AB 4.00
>>>11111 OT 8.00
>>>22222 AB 4.00
>>>22222 OT 6.00
>>>22222 OT 4.00
>>>
>>>to get a new table after the addition :
>>>
>>>NEWTABLE.DBF
>>>empno numberAB durationAB numberOT durationOT
>>>11111 2 12.00 1 8.00
>>>22222 1 4.00 2 10.00
>>>
>>>Any help on coding would appreciate a lot.
>>>PP
>>
>>
select empno, ;
>>  sum(iif(code='AB',1,0)) as NumberAB, ;
>>  sum(iif(code='AB',time,0)) as DurationAB, ;
>>  sum(iif(code='OT',1,0)) as NumberOT, ;
>>  sum(iif(code='OT',time,0)) as DurationOT ;
>>  from myTable ;
>>  group by empno
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform