MySQL not returning null column joined value -
i have these 4 tables:
my expected result:
this current query (helped here)
select a.no_registrasi, a.nama_ctki, b.nama_negara, concat('ra-', max(substring(c.id_rad, 4) + 0)) id_rad, concat('lab-',max(substring(d.id_lab, 5) + 0)) id_lab tb_registrasi join tb_negara_tujuan b on a.id_negara = b.id_negara join tb_radiologi c on a.no_registrasi = c.no_registrasi join tb_laboratorium d on a.no_registrasi = d.no_registrasi group a.no_registrasi, a.nama_ctki, b.nama_negara
how result im expecting for? i'm unexperienced in advanced query this, apreciated. thank you.
hope helps.
select a.no_registrasi, a.nama_ctki, b.nama_negara, concat('ra-', max(substring(c.id_rad, 4) + 0)) id_rad, concat('lab-',max(substring(d.id_lab, 5) + 0)) id_lab tb_registrasi left join tb_negara_tujuan b on a.id_negara = b.id_negara left join tb_radiologi c on a.no_registrasi = c.no_registrasi left join tb_laboratorium d on a.no_registrasi = d.no_registrasi group a.no_registrasi, a.nama_ctki, b.nama_negara
Comments
Post a Comment