MYSQL SUM field with join and condition

I have two table with different amount of rows, i want SUM field (jumlah) but the field which should be from 2nd table is empty instead filled with number from other field

This My sql query

SELECT a.nama_kebutuhan, SUM(a.jumlah) as jumlah1, SUM(b.jumlah) as jumlah2
FROM kebutuhan AS a 
INNER JOIN supply AS b ON b.no = a.no
WHERE a.no = '17717072'
GROUP BY a.`nama_kebutuhan`

Table kebutuhan

id |   no   | nama_kebutuhan | jumlah
-------------------------------------
151|17717072| Pagar Panel MF | 10
152|17717072| U 30.30.120 T3 | 30

Tabel supply

id |   no   | nama_barang  | penyedia
-------------------------------------
1  |17717072|U 30.30.120 T3|  5

The result should be

 nama_kebutuhan | jumlah1 | jumlah2
-------------------------------------
 Pagar Panel MF |   10    |  NULL
 U 30.30.120 T3 |   30    |   5

Answer

Use LEFT JOIN and ADD nama_kebutuhan = nama_barang with no in ON clause for retrieving desired output.

-- MySQL (v5.8)
SELECT k.nama_kebutuhan
     , SUM(k.jumlah) AS 'jumlah'
     , SUM(s.penyedia) AS 'jumlah2' 
FROM kebutuhan k
LEFT JOIN supply s 
       ON s.no=k.no 
      AND k.nama_kebutuhan = s.nama_barang
WHERE k.no = '17717072'       
GROUP BY k.nama_kebutuhan;

Please check from url https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=5c30cd911a29a01c6b89b334d335e5ce