Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Basic SQL clause question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00700804
Message ID:
00700829
Vues:
10
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform