我有两个表 - tmst_paket
和tmst_paketdata
- 还有一个这样的查询:
SELECT
p.id_paket,
p.id_user,
p.nama_paket,
p.id_instansi,
p.id_relasi,
p.status_progress,
p.status_paket,
p.from_status,
p.to_status,
COALESCE(sum(pd.kuantitas))total_buku,
COALESCE(sum(pd.total_hargaitem))total_hargabuku,
DATE_FORMAT(p.tgl_buat,'%d-%m-%Y') created_date_formatted,
DATE_FORMAT(p.tgl_modif,'%d-%m-%Y') modified_date_formatted
FROM
tmst_paket p
JOIN
tmst_paketdata pd
ON
p.id_paket = pd.id_paket
ORDER BY
p.id_paket
当表具有值时查询成功,但如果表为空,它仍然显示该行,但值为NULL
。我一直试图添加像
WHERE
pd.id_paket IS NOT NULL
但结果仍然相同;该行显示为null。如何将结果设为空列表?