Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Complicated Query
Message
 
 
À
11/12/2008 11:43:46
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:
01366648
Message ID:
01366674
Vues:
8
See also Re: Table from Vertical to horizontal Thread #1365804 for the ideas. You can not do this in one query in VFP (except for using UDF), though you can do this easily in SQL Server.

>Dear Experts
>
>I have folloiwng database
>
>
>create cursor temp(vou_no n(6), acc_code c(7),party c(1),qty n(8),rate n(7,2),cr_amount n(15,2))
>
>insert into temp(vou_no,acc_code,party,qty,rate);
>	values(3322,'3201003','A',50,460)
>
>insert into temp(vou_no,acc_code,party,qty,rate);
>	values(3322,'3202001','B',95,410)
>
>insert into temp(vou_no,acc_code,party,qty,rate);
>	values(3322,'3206003','C',1,1415)
>
>insert into temp(vou_no,acc_code,party,qty,rate);
>	values(3322,'3207001','D',2,1415)
>
>insert into temp(vou_no,acc_code,party,qty,rate);
>	values(3323,'3201003','A',20,460)
>
>insert into temp(vou_no,acc_code,party,qty,rate);
>	values(3323,'3202001','B',25,410)
>
>
>To make group I use following codes
>
>
>select vou_no,acc_code,party,sum(qty)as qty,sum(qty*rate)as cr_amount;
>	from temp;
>	order by vou_no,party;
>	group by vou_no,party;
>	into cursor temp2
>
>
>But....
>I want to get result as follows
>
>vou_no--a---b---c---d---cr_amount
>

>3322---50---95--1---2----66195
>3323---20---25--0---0----19450
>
>
>Please help
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform