Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Merge four tables into 1 cursor
Message
 
To
28/12/2004 03:51:58
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Novell 4.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00972379
Message ID:
00972501
Views:
21
Because I don't know what You want to do. How to relate SiMain to SisUp?
1. All records from SiMain & only one record from SisUp that match record from SiMain
or
2. All Records from SiMain & all records from SisUp that match record from SiMain

for 1. old syntax must work well
    SELECT SiMain.*, SisUb.ICode, SisUb.qntymaj, , SisUb.qntymin, , SisUb.RateMaj, SisUb.RateMin,;
           PCode.PName, Icode.full_desc;
           FROM SiMain;
           LEFT JOIN SisUp ON SiMain.SiNo  == SisUp.SiNo; && May be You need RIGHT JOIN here?
           LEFT JOIN PCode ON SiMain.PCode == PCode.PCode;
           LEFT JOIN Icode ON SisUp.Icode  == Icode.Icode;
           WHERE BETWEEN(Simain.Invdate, mdt1, mdt2)        .AND.;
                 UPPER(Simain.Salesman) == UPPER(msalesman) .AND.;
                 Simain.PCode == mpcode;
    INTO CURSOR cTest
for 2.
    SELECT SiMain.*, SisUb.ICode, SisUb.qntymaj, , SisUb.qntymin, , SisUb.RateMaj, SisUb.RateMin,;
           PCode.PName, Icode.full_desc;
           FROM SiMain;
           RIGHT JOIN SisUp ON SiMain.SiNo == SisUp.SiNo; 
           LEFT JOIN PCode ON SiMain.PCode == PCode.PCode;
           LEFT JOIN Icode ON SisUp.Icode  == Icode.Icode;
           WHERE BETWEEN(Simain.Invdate, mdt1, mdt2)        .AND.;
                 UPPER(Simain.Salesman) == UPPER(msalesman) .AND.;
                 Simain.PCode == mpcode;
    INTO CURSOR cTest
BTW Is the Report running?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform