Skip to content

Instantly share code, notes, and snippets.

@rizkytegar
Created October 28, 2023 04:57
Show Gist options
  • Save rizkytegar/ce99d28e3326f30022052e680f5d7026 to your computer and use it in GitHub Desktop.
Save rizkytegar/ce99d28e3326f30022052e680f5d7026 to your computer and use it in GitHub Desktop.
SELECT
p.nama AS 'NAMA PEGAWAI',
(
SELECT
m.nama
FROM
pegawai AS m
WHERE
m.id_pegawai = p.id_manager
) AS 'NAMA MANAGER'
FROM
`pegawai` AS p
WHERE
EXISTS(
SELECT
1
FROM
pegawai AS m
WHERE
m.id_pegawai = p.id_manager
) ORDER BY
p.id_manager ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment