Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help on sql-query
Message
From
11/09/2008 02:45:45
 
 
To
11/09/2008 02:34:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01346517
Message ID:
01346519
Views:
4
>I have a table with values
>
>empno year amt
>A 2004 45.23
>A 2005 54.56
>A 2006 89.56
>B 2004 44.33
>B 2005 22.15
>B 2006 48.98
>C 2004 55.00
>C 2005 56.13
>C 2006 44.56
>
>
>How can I have a table that will appear like this
>empno 2004 2005 2006
>A 45.23 54.56 89.56
>B 44.33 22.15 48.98
>C 55.00 56.13 44.56
CREATE CURSOR crsTest (empno C(1), year I, amt N(5,2))
INSERT INTO crsTest VALUES ('A',2004,45.23)
INSERT INTO crsTest VALUES ('A',2005,54.56)
INSERT INTO crsTest VALUES ('A',2006,89.56)
INSERT INTO crsTest VALUES ('B',2004,44.33)
INSERT INTO crsTest VALUES ('B',2005,22.15)
INSERT INTO crsTest VALUES ('B',2006,48.98)
INSERT INTO crsTest VALUES ('C',2004,55.00)
INSERT INTO crsTest VALUES ('C',2005,56.13)
INSERT INTO crsTest VALUES ('C',2006,44.56)

DO (_GENXTAB) WITH 'crsTab', .t., .f., .t., 'EmpNo','Year','Amt'
SELECT crsTab
BROWSE NORMAL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform