Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Merge four tables into 1 cursor
Message
 
À
29/12/2004 04:14:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Novell 4.x
Database:
Visual FoxPro
Divers
Thread ID:
00972379
Message ID:
00972850
Vues:
13
If You don't bother of other fields in SisUb You can change SQL to get total:

** When You change version of VFP You may have problems :o)))
**** First Change see SUM()
whole_sql ="SELECT SiMain.*, SisUb.ICode, SUM(SisUb.qntymaj) AS QntyMaj, SUM(SisUb.qntymin) AS QntyMin, SisUb.RateMaj, 
SisUb.RateMin, "+;
                   "PCode.PName, Icode.full_desc, Icode.unit "+;
                   "FROM SiMain "+;
                   "RIGHT JOIN SisUb ON SiMain.SiNo  == SisUb.SiNo "+;
                   "LEFT JOIN PCode ON SiMain.PCode == PCode.PCode "+;
                   "LEFT JOIN Icode ON sisub.Icode  == Icode.Icode "+;
                   "WHERE BETWEEN(Simain.Invdate, mdt1, mdt2)"

msalesman = UPPER(This.Parent.msalesman.Value)
mpcode    = This.Parent.mpcode.Value 
IF This.Parent.Check1.Value = 1 && Filter only by some SalesMan
   whole_sql = whole_sql + " .AND. UPPER(Simain.Salesman) == '"+msalesman+"'"
ENDIF

IF This.Parent.Check2.Value = 1 && Filter only by some PCOde
   whole_sql = whole_sql + " .AND. Simain.PCode == '"+This.Parent.mpcode.Value+"'"
ENDIF

** Second Change added GROUP BY clause
whole_sql = whole_sql +" GROUP BY SiMain.PCode, SisUb.ICode ORDER BY SiMain.PCode INTO CURSOR tempsale"
Pls check if it works, because I can't test it.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform