Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement
Message
From
11/02/2007 09:16:57
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01194505
Message ID:
01194533
Views:
19
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform