Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Grouping
Message
From
30/06/2008 17:02:13
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Data Grouping
Miscellaneous
Thread ID:
01327739
Message ID:
01327739
Views:
46
Dear Experts

I have two tables table1 and table2 as
 Create Cursor table1 ;
 (date d(8),code Char(7),name Char(20), sale_in N(12))
 
 Insert Into table1 Values ({^2008-01-15},'1401001','eric',10)
 Insert Into table1 Values ({^2008-01-15},'1401002','bill',20)
 Insert Into table1 Values ({^2008-01-16},'1401001','eric',30)
 Insert Into table1 Values ({^2008-01-17},'1401001','eric',40)
 Insert Into table1 Values ({^2008-01-18},'1401001','eric',50)
 Insert Into table1 Values ({^2008-01-17},'1402001','tushar',40)
 Insert Into table1 Values ({^2008-01-18},'1402003','samir',50)
 
 Create Cursor table2;
 (date d(8),code Char(7),name Char(20), sale_out N(12))
 
 Insert Into table2 Values ({^2008-01-15},'1401001','eric',110)
 Insert Into table2 Values ({^2008-01-15},'1401002','bill',120)
 Insert Into table2 Values ({^2008-01-16},'1401001','eric',130)
 Insert Into table2 Values ({^2008-01-17},'1401001','eric',140)
 Insert Into table2 Values ({^2008-01-18},'1401001','eric',150)
 Insert Into table2 Values ({^2008-01-17},'1402001','tushar',140)
 Insert Into table2 Values ({^2008-01-18},'1402003','samir',150)
I need folloiwng result

-----Date------|------A-----|------B------|
-----------------|--In---Out-|--In---Out-|
15-01-2008-|-30---230-|---0------0-|
16-01-2008-|-30---130-|---0------0-|
17-01-2008-|-40---140-|-40---140-|
18-01-2008-|-50---150-|-50---150-|

There will be a unique date containing sale_in nd salue_out values against every unique group.
every unique group in cross tab will be based on left four characters of code
1401001 will go to A column
1402002 will go to B column

IF there is code=1403001 THEN it will be group c and so on.

Please help
Next
Reply
Map
View

Click here to load this message in the networking platform