Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More Complicated Query
Message
From
14/05/2008 22:42:00
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
More Complicated Query
Miscellaneous
Thread ID:
01317209
Message ID:
01317209
Views:
49
Dear Experts
Create Cursor table1 ;
(date d(8),code Char(7),name Char(30), qty n(4), credit N(12), Debit N(12), code2 Char(7))

Insert Into table1 Values ({^2008-01-15},'1401001','Eric',0,0,100,'3201001')
Insert Into table1 Values ({^2008-01-15},'3201001','Apple',10,100,0,'1401001')
Insert Into table1 Values ({^2008-01-15},'1401001','Eric',0,0,200,'3202001')
Insert Into table1 Values ({^2008-01-15},'3202001','Potato',20,200,0,'1401001')
Insert Into table1 Values ({^2008-02-18},'1401001','Eric',0,0,600,'3202001')
Insert Into table1 Values ({^2008-02-18},'3202001','Potato',40,600,0,'1401001')
Insert Into table1 Values ({^2008-06-17},'1401002','Boris',0,0,300,'3202001')
Insert Into table1 Values ({^2008-06-17},'3202001','Juice',20,300,0,'1401002')
A shopkeeper wants to see Product wise monthly sale summary


The result must look like this

month---qty---amt1--amt2---total
Jan08---30----100----200-----300
Feb08---40--------0----600-----600
Jun08---20--------0----300-----300

Hints:
amt1 is amount of codes begins with 3201
amt2 is amount of codes begins with 3202
total is sum of amt1+amt2

This thread is second part of SOLVED Thread ID # 1316576

Please help
Next
Reply
Map
View

Click here to load this message in the networking platform