0

这是我的代码的结果,但我将总结示例 nodid 1.1 和 1.2 报告:发票附录

  1. InvoiceNo 8027944
    ExtRef: 1600056051
    订购金额 3 395 300,00 kr
    Ordername Registrering i Fenix E
    Rest: 3 395 300,00 kr
    发票日期 2012-11-06

  2. 这是我的输出,但这不对

     Our reference   Nod_id     In nodid   amount
    1960110000       1.1        1              0,00    
    1960110001       1.1.1      1.1        29000,00       
    1960120000       1.1.2      1.1         5000,00
    1960130000       1.2        1              0,00
    1960130001       1.2.1      1.2         1920,00
    

  1. 我有这个输出

     Our reference   Nod_id     In nodid   amount
    1960110000       1.1        1          34000,00<br>
    1960130000       1.2        1           1920,00</li>
    

我的问题是我将总结例如 Nod_id 1.1 和 1.2 的行,但我将有我们的参考 1960110000 和描述位置 1 ......我的代码

sql, 1 DBSELECT 
t.project,
t.work_order as projakt,
t1.orderram,
t2.flag ,
t2.ext_inv_ref,
t2.work_order,
t2.used_hrs,
t2.cur_amount as belopp,
t4.description, 
t5.nod_id_2 as ing_nodid,
t5.nod_id_1 as nodid,
t5.ingar_pakt as namn,
t2.work_order,
SUM(t2.used_hrs) as used_hrs,
SUM(t2.cur_amount) as belopp
from  atsworkorder t
left join  afx01projact4  t5 on t.client =t5.client and t.work_order = t5.dim_value and t5.attribute_id = 'BF' 
left join afx01projact2  t1 on t.client=t1.client and t.work_order = t1.dim_value
left join atsinvhistr t2 on t.client=t2.client and t.work_order  = t2.work_order and '<datum>' >= t2.voucher_date
left join agldescription t4 on t.client =t4.client and t4.dim_value = t.work_order
where  t.project ='<proj>'  and t.client = '<client>'  
group by
t.project,
t.work_order,
t2.work_order,
t5.nod_id_1,
t5.dim_value,
t5.nod_id_2 ,
t5.ingar_pakt ,
t1.orderram,
t2.flag,
t2.ext_inv_ref,
t2.used_hrs,
t2.cur_amount,
t4.description
order by nodid
4

0 回答 0