Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Command
Message
From
24/03/1997 05:53:30
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
SQL Command
Miscellaneous
Thread ID:
00025377
Message ID:
00025377
Views:
60
I have 2 tables containing fields of :

Table 1 :
Employee ID Company
001 AAA
002 BBB

Table 2 :
Employee ID Period Basic Amount
001 199610 1000
002 199610 2000
001 199611 1200
002 199611 500

How can I try to create a cursor using SQL with end result of
Company 199610 199611
AAA 1000 1200
BBB 2000 500
.......
I have try the following :
SELECT table1.company, sum(table2.amount) ;
FROM table1 INNER JOIN table2 ;
ON table1.empid = table2.empid;
WHERE table2.period = '199610';
GROUP BY table1.company;
ORDER BY table1.company INTO CURSOR lc1
SELECT table1.company, sum(table2.amount) ;
FROM table1 INNER JOIN table2 ;
ON table1.empid = table2.empid;
WHERE table2.period = '199611';
GROUP BY table1.company;
ORDER BY tbale1.company INTO CURSOR lc2

SELECT * FROM lc1 INNER JOIN lc2 ON lc1.company=lc2.company INTO CURSOR lc3

PROBLEM is the cursor now is of structure :
Company_a
Basic_a
Company_b
Basic_b

Thanks in advance.
Next
Reply
Map
View

Click here to load this message in the networking platform