MYSQL如果那么

时间:2016-09-03 10:14:27

标签: mysql

我正在尝试使用if then then语句但没有成功,这里是我的代码

    SELECT * FROM mahasiswa
IF (id_jns_daftar = 2) THEN
INNER JOIN kuliahmhs on mahasiswa.id_reg_pd = kuliahmhs.id_reg_pd
WHERE NULLIF(sks_diakui, '') IS NULL 
OR NULLIF(sks_diakui, ' ') IS NULL
OR NULLIF(sks_diakui, '  ') IS NULL
OR NULLIF(sks_diakui, '-') IS NULL
OR NULLIF(sks_diakui, '--') IS NULL
OR NULLIF(sks_diakui, '---') IS NULL
OR NULLIF(sks_diakui, 0) IS NULL
OR NULLIF(sks_diakui, '0') IS NULL
OR sks_diakui != sks_total

关键是,如果id_jns_daftar = 2,则检查其他为NULL的列并仅显示结果id_jns_daftar = 2

0 个答案:

没有答案