• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Catatan Kueri Untuk Menggabungkan Dua Tabel SQL

Kepala Suku

Web & Mobile Developer
Staff member
#1
Contoh kueri untuk menggabungkan dua buah tabel di dalam SQL:

SQL:
SELECT m.tanggal as tanggal, b.nama as uraian, m.dibayar as kas_masuk, '' as kas_keluar FROM pemasukan m
LEFT JOIN biaya b
ON m.biaya=b.id
UNION
SELECT k.tanggal_keluar as tgl, k.nama as uraian, '' as kas_masuk, k.nominal as kas_keluar FROM pengeluaran k