Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anyway to optimize this
Message
De
19/02/2006 12:07:30
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Anyway to optimize this
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01097411
Message ID:
01097411
Vues:
58
Hi,
I have this situation

Table1 ( a(C), b(C) )

1 prod1
2 prod2
3 prod3

Table2 ( a(C), c(N) )
1 100.00
2 20.00
1 50.00
2 10.00
3 200.00

Table3 ( a(C), d(N) )

1 100.00
2 20.00

I want

Table4 ( a(C), b(C), sum(c,d) )

looking like

1 250.00
2 50.00
3 200.00

Any sugestions ?
I currently use (but think is to big :))

SELECT Komintenti.sifra_kom AS sifra, NVL(SUM(Smetki.iznos_sd),0.00) AS iznos;
FROM Komintenti LEFT OUTER JOIN Smetki ON Komintenti.sifra_kom==Smetki.sifra_kom ;
GROUP BY sifra INTO CURSOR posmetki

SELECT Komintenti.sifra_kom AS sifra, NVL(SUM(Fakturi.iznos_sd),0.00) AS iznos;
FROM Komintenti LEFT OUTER JOIN Fakturi ON Komintenti.sifra_kom==Fakturi.sifra_kom ;
GROUP BY sifra INTO CURSOR pofakturi

SELECT posmetki.sifra, posmetki.iznos+pofakturi.iznos ;
FROM posmetki LEFT OUTER JOIN pofakturi ON posmetki.sifra=pofakturi.sifra;
GROUP BY posmetki.sifra INTO CURSOR final

Can it be Optimized in to one query.
Vladimir Martinovski
VCS Software Inc.
"May the FOX be with You"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform