Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyway to optimize this
Message
From
19/02/2006 12:07:30
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Anyway to optimize this
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01097411
Message ID:
01097411
Views:
60
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"
Next
Reply
Map
View

Click here to load this message in the networking platform