Dear para master mohon bantuannya saya sudah sangat stuck, kira2 apakah bisa dan bagaimana menggabungkan 3 query sql menjadi 1 sql query karena ingin ku jadikan (while) dengan syatax sql sebagai berikut,Terima kasih banyak sebelumnya dan mohon bantuannya.
//sql pertama
$sql1="select SUM(nom_bunga) as nom_bunga, tgl_entry from angsuran group by MONTHNAME(tgl_entry), YEAR(tgl_entry) order by tgl_entry desc";
//sql kedua
$sql2="select SUM(tabungan) as tabungan, MONTHNAME(tanggal_simpan) as bulan, YEAR(tanggal_simpan) as tahun, (select SUM(tabungan) from simpanan b where jenis = 'SIMPANAN WAJIB' and MONTHNAME(a.tanggal_simpan) = MONTHNAME(b.tanggal_simpan) and YEAR(a.tanggal_simpan) = YEAR(b.tanggal_simpan)) as wajib, (select SUM(tabungan) from simpanan c where jenis = 'SIMPANAN POKOK' and MONTHNAME(a.tanggal_simpan) = MONTHNAME(c.tanggal_simpan) and YEAR(a.tanggal_simpan) = YEAR(c.tanggal_simpan)) as pokok from simpanan a group by MONTHNAME(tanggal_simpan), YEAR(tanggal_simpan) order by tanggal_simpan asc";
//sql ketiga
$date1=date('Y-m-d');//variabel date
$sql2="select a.tabungan as shu, id_simpan, nopeg, nama, department, unit, jenis, besar, (SELECT b.tabungan FROM simpanan b where a.id_simpan = b.id_simpan and b.status='Aktif' AND b.jenis='Simpanan Wajib' and b.tanggal_simpan in (SELECT MAX(c.tanggal_simpan) FROM simpanan c where c.jenis = 'Simpanan Wajib' and c.id_simpan = b.id_simpan)) as wajib from simpanan a where a.jenis='Simpanan SHU' and a.tanggal_simpan <= '$date' ORDER BY `a`.`id_simpan` ASC";