Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Statement
Message
De
11/02/2007 09:16:57
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
01194505
Message ID:
01194533
Vues:
18
Hi Sergey,

I try your solution but i have a problem because the fields in the 1st and 2 select don't match, and i need to filter de 2nd query between 2 dates.

Do you have any other sugestion???
select a.c_cod_ter , 
SUM(CASE a.n_debcre WHEN 1 THEN a.n_val_doc ELSE 0 END) as cre,
SUM(CASE a.n_debcre WHEN 2 THEN a.n_val_doc ELSE 0 END) as deb,
where a.n_tipo_ter=1 
group by a.c_cod_ter

UNION all

select b.c_cod_ter, b.n_debcre, b.n_val_doc, c.c_descri, ....
from tbl_gc_MovimentosCCO b
inner join tbl_gc_Clientes c
on b.c_cod_ter=c.c_codigo
where b.n_tipo_ter=1 ......
order by c_cod_ter
João Batista
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform