Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cross Tab Query
Message
 
 
To
10/06/2010 03:14:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01468247
Message ID:
01468269
Views:
34
Take a look at FastXTab in Downloads section here.

Knowing how Dynamic Pivot is done in SQL Server, I can probably come up myself with an algorithm (create dynamic command with case statements, etc.)



>Dear Experts
>
>
>CREATE CURSOR crsalp(date d(8),acc_code c(7),acc_name c(10),amount n(5))
>CREATE CURSOR crprp(date d(8),acc_code c(7),acc_name c(10),amount n(5))
>CREATE CURSOR vouchers(date d(8),acc_code c(7),acc_name c(10),amount n(5))
>
>INSERT INTO crsalp VALUES ({^2010-05-14},"1","eric",100)
>INSERT INTO crsalp VALUES ({^2010-05-14},"1","eric",200)
>INSERT INTO crsalp VALUES ({^2010-05-15},"1","eric",200)
>INSERT INTO crsalp VALUES ({^2010-05-15},"2","boris",100)
>INSERT INTO crsalp VALUES ({^2010-05-15},"2","boris",100)
>INSERT INTO crsalp VALUES ({^2010-05-18},"5","anders",500)
>
>INSERT INTO crprp VALUES ({^2010-05-14},"1","eric",1100)
>INSERT INTO crprp VALUES ({^2010-05-14},"1","eric",1200)
>INSERT INTO crprp VALUES ({^2010-05-15},"1","eric",1200)
>INSERT INTO crprp VALUES ({^2010-05-15},"2","boris",1100)
>INSERT INTO crprp VALUES ({^2010-05-15},"2","boris",1100)
>INSERT INTO crprp VALUES ({^2010-05-16},"3","cetin",1500)
>
>INSERT INTO vouchers VALUES ({^2010-05-14},"5","anders",100)
>INSERT INTO vouchers VALUES ({^2010-05-18},"1","eric",250)
>
>
>Now I want to get date wise total of amount field as
>
>----date--------------1----------2---------3----------5
>2010-05-14---2600----------0---------0-------100
>2010-05-15---1400-----2400---------0----------0
>2010-05-16--------0----------0----1500----------0
>2010-05-18----250----------0----------0------500
>
>acc_code will be displayed as coulmn headings
>
>this is cross tab query.
>
>
>Please help
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform