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