can u guys help me fix this up..
the error said ‘ Unknown column ‘d.idspesialis’ in ‘on clause’ ‘
SELECT a.*, b.*, c.*, e.*,d.*, f.*,g.*
FROM ckehamilan a
INNER JOIN pasien b
ON a.noRM=b.noRM
INNER JOIN ( select idPegawai , NamaPegawai as NamaDokter from tpegawai ) d
ON a.idPegawai=d.idPegawai
LEFT JOIN spesialis e
ON e.idspesialis=d.idspesialis
INNER JOIN ( select idPegawai , NamaPegawai as NamaParamedis from tpegawai ) f
ON a.idparamedis=f.idPegawai
LEFT JOIN imunisasi g
ON a.idimunisasi=g.idimunisasi
INNER JOIN ruang c
ON a.idruang=c.idruang
your subquery doesn’t have column
idspesialistry this,
your full query should look like below,