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:
00700829
Views:
9
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