Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by summary
Message
 
 
À
06/08/2007 04:45:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01246096
Message ID:
01246107
Vues:
22
>Dear Experts
>
>Table1 has four fields as
>
>code n(4)
>name n(4)
>amount n(5)
>type c(1)
>
>Data in fields is as
>
>code----name----amount--type
>1101----Eric-----100-----B
>1202----Bill-------200-----B
>1506----Boris----600-----A
>1608----Cetin----900-----A
>1709----Jack-----800-----A
>2101----Ali--------900-----B
>2202----Tame---100-----A
>2608----Zahi-----100-----A
>
>I need following output based on two conditions
>
>Group + type
>Every group is based on First digit of code
>Type is based on A and B
>
>Codes between 1100 to 1900 is Group 1
>Codes between 2000 to 2900 is Group 2 and so on
>
>This should be Final Output
>
>code----name----amount--type
>2--------2-------300------B && total of group 1 with type=B
>3--------3-------1700-----A && total of group 1 with type=A
>1--------1-------900------B && total of group 2 with type=B
>2--------2-------200------A && total of group 2 with type=A
>
>
>Please help
select left(str(group),1) as Code, type, sum(Amount) as Amount from myTable ;
group by 1, 2 into cursor curOutput
It's not clear what is name here?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform