Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Complicated Query
Message
De
13/05/2008 02:55:34
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Complicated Query
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01316576
Message ID:
01316576
Vues:
49
Dear Experts

Eric goes to bazar and purchase some fruit and vegetable

Transcation is Table1 will be lool like as

--code---name-----qty-----credit-----Debit-----code2
1401001--Eric-------0---------0--------100--------3201001
3201001--Apple----10------100----------0--------1401001
1401001--Eric------0---------0--------200--------3202001
3202001--Potato-20--------200-----------0--------1401001

Now I want to get purchase summary as

--code---name-----qty---amount1--amount2
1401001--Eric-----30-----100--------200

amount1 is price of Fruit items, strarts with 3201
amount1 is price of Vegetable items, strarts with 3202

I wrote this statement but it displays all items
group_wise_sale =  "csr" + sys(2015)
select code,name,;
	sum(iif(left(code,4)='3201',cr_amount,0)) as amount_fruit_items,;
	sum(iif(left(code,4)='3202',cr_amount,0)) as amount_non_fruit_items;
	from table1;
	order by code ;
	group by code ;
	into cursor group_wise_sale

select group_wise_sale
brow
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform