MySQL not returning null column joined value -


i have these 4 tables:
tables

my expected result:
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 

this result query:
enter image description here

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

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -