2017-04-18 74 views
-2

我有3个表选择和3台不同的记录

  1. tb_spp
  2. tb_daycare
  3. tb_antarjemput

这里是所有三个表的内容:

  1. tb_spp

enter image description here

  • tb_daycare
  • enter image description here

  • tb_antarjemput
  • enter image description here

    我想outpunya这样

    enter image description here

    而对于最后的输出是限制1这样的:

    enter image description here

    如何掌握?

    +0

    这是功课? – qxg

    +0

    是的,那是真的 –

    +0

    请帮助我。 –

    回答

    -1

    你可以参考我的查询选项1.

    select T1.kode, 
         T1.Nominal_spp, 
         T2.Nominal_antarjemput, 
         (IFNULL(T1.Nominal_spp, 0)*2 + IFNULL(T2.Nominal_antarjemput, 0)) as Total 
    from tb_spp as T1 
    left join tb_antarjemput as T2 on T1.kode = T2.kode 
    
    +0

    #1582 - 调用本地函数'ISNULL'时的参数计数不正确 –

    +0

    您使用Sql或MySQL我的朋友吗? – Tomato32

    +0

    sql兄弟,但错误 –