Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is this possible in one select?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00793100
Message ID:
00793108
Vues:
28
This message has been marked as the solution to the initial question of the thread.
Try
SELECT Country,  CarGroup, ;
            SUM(IIF(MinDays=1, Rate, 00)) AS Rate1, ;
            SUM(IIF(MinDays=3, Rate, 00)) AS Rate3, ;
            SUM(IIF(MinDays=7, Rate, 00)) AS Rate7 ;
  GROUP BY 1,2
...
>Hi All
>Is the following possible in just one select? I have the following table:
>Country  CarGroup  MinDays  Rate
>   US        A        1      20
>   US        A        7      18
>   US        B        1      25
>   US        B        7      22
>   FR        A        3      21
>   FR        A        7      19
>
>
>I would like for the above example to obtain the following:
>Country  CarGroup  Rate1  Rate3  Rate7
>   US        A       20     0      18
>   US        B       25     0      22
>   FR        A        0    21      19
>
>I need it in one select since it;s the base for a par. view...
>
>TIA
>Jaime
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform