3
I’ve tried this code, but it only adds up to one line, if you modify the where
, error or wrong sum, need to add each separate line.
I need to add these two fields with several lines.
km_h_tp
is the table fieldt_trocaprogramadas
km_h_pl
is the table fieldt_planos
sql:
select (select sum(km_h_tp) from t_trocaprogramadas where fkplanos_tp =1) +
(select sum(km_h_pl) from t_planos where idt_plano =1)'Proxima Troca';
I formatted your question to make it more readable, but you still need to [Edit] and explain better what you want. It is not possible to know exactly what it is to add to what, what you call separate lines, etc. It would be better to add an example of how your data is, and how the result should look.
– Bacco
Post also the DDL of the tables to know how the two tables relate.
– Reginaldo Rigo