Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is this possible in one select?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00793100
Message ID:
00793112
Views:
24
Excellent! I forgot that since there is a unique Country+CarGroup id everytime, i can use sum... Thank you very much.
Jaime

>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
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