Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select one from a group
Message
 
 
To
13/03/2000 14:12:50
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00345076
Message ID:
00345088
Views:
21
Hi Michael,

>
WorkDate / TrainTime
>03/06/00
>03/07/00   4:00
>03/08/00
>03/09/00
>What is the syntax to select the "4:00" as the total training time for the days 3/6 - 3/9? (assumes only one value in list, else blank)
>
>Sele iif(!empty(traintime),traintime,space(4)) as TotTrain
>
>arbitrarily grabs the first record, evaluates the iif and likely stores the wrong value to TotTrain. This field is character, so sum() is not available on this field without a lot of string manipulation.
>
>Is there an easy way to do this?

I'm afraid, not. You should firstly select all records without grouping like:
select *, iif(empty(trantime),0,val(left(trantime,at(':',trantime)-1)) as TrainHours, iif(empty(trantime),0,val(substr(trantime,at(':',trantime)+1)) as
TrianMin. When do grouping and sum, then, probably, another select to format back into TrainTime.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform