Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Basic SQL clause question
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00700804
Message ID:
00700836
Views:
9
Nice! Indeed, i always run my select to a READWRITE cursor, where i do some work afterwards, but sometimes i like the direct approach...
Thanks a lot for all your help
Jaime

>Yes, you can.
...
>    ROUND(Sum(IIF(BETWEEN(Reservations.date, OldFrom, OldTo), 1, 0)*100/ ;
>        Sum(IIF(BETWEEN(Reservations.date, ReportFrom, ReportTo), 1, 0), 2) AS percent, ;
>...
However, it would be simplier to use second select for that.
>
>>Thx Sergey, you nailed it again.
>>Do you think i can also retrieve in this same SELECT the percentage growth ( or reduction ) between CurRes and OldRes?
>>
>>
>>>Try
SELECT ;
>>>    Clients.ClientName, ;
>>>    Sum(IIF(BETWEEN(Reservations.date, ReportFrom, ReportTo), 1, 0) as CurRes,;
>>>    Sum(IIF(BETWEEN(Reservations.date, ReportFrom, ReportTo), Reservations.Amount, 0) as CurAmount, ;
>>>    Sum(IIF(BETWEEN(Reservations.date, OldFrom, OldTo), 1, 0) as OldRes,;
>>>    Sum(IIF(BETWEEN(Reservations.date, OldFrom, OldTo), Reservations.Amount, 0) as OldAmount, ;
>>>  FROM Reservations JOIN Clients ;
>>>        ON Reservations.ClientCode=Clients.Code  ;
>>>  WHERE between( Reservations.date, ReportFrom, ReportTo ) ;
>>>         OR between( Reservations.date, OldFrom, OldTo ) ;
>>>  GROUP BY Clients.Code ;
>>>INTO CURSOR crsResult	
>>>
Why do programs stop working correctly as soon as you leave the Fox?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform