Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using View
Message
 
À
05/09/2002 02:46:36
Jeffrey Ang
JGA Software Inc.
Davao, Philippines
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00696981
Message ID:
00697110
Vues:
16
When the tables are pretty big, the union operator last too long to retrieve the results.

Based on the structure you gave, you can try this:

select a.code, a.summt + b.summt as summt
from
(
select code, sum(amount) as SumMt
from tbla
group by code
) a,
(
select code, sum(amount) as SumMt
from tblb
group by code
) b
where a.code = b.code
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform