“CASE” Pada Mysql

tblnilai (simbol, nilai)

A=9

B=7

C=6

D=5

E=4.5

tblNMahasiswa(nim, nilai)

1234 = A

1122 = C

3345 = E

menampilkan nilai mahasiswa

select tblNMahasiswa.nim, (case tblNMahasiswa.nilai when tblNMahasiswa.nilai=tblNilai.simbol then tblNilai.nilai) as nilai from tblNilai, tblNMahasiswa;

maka akan tampil:

nim | nilai

1234 | 9

1122 | 6

3345 | 4.5

:))

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: