如何修复javax.servlet.ServletException:java.sql.SQLException:子查询返回超过1行

时间:2016-02-23 08:10:04

标签: mysql sql

DELIMITER $$ 
DROP view 
IF EXISTS `poliklinik`.`view_daftar_pasien`$$ 
  CREATE algorithm=undefined definer=`root`@`localhost` SQL security definer view `view_daftar_pasien`
  AS 
    ( 
           SELECT `pendaftaran`.`no_antri`  AS `no_antri`, 
                  `pendaftaran`.`id_daftar` AS `id_daftar`, 
                  `pasien`.`nama_pasien`    AS `nama_pasien`, 
                  `pendaftaran`.`id_dokter` AS `id_dokter`, 
                  ( 
                         SELECT IF(isnull( 
                                ( 
                                       SELECT `rekam_medis`.`id_daftar` AS `id_daftar` 
                                       FROM   `rekam_medis` 
                                       WHERE  ( 
                                                     `rekam_medis`.`id_daftar` = `pendaftaran`.`id_daftar`))),_utf8'Belum Diperiksa',IF(isnull(
                                ( 
                                       SELECT `rekam_medis`.`id_daftar` AS `id_daftar` 
                                       FROM   `rekam_medis` 
                                       WHERE  (( 
                                                            `rekam_medis`.`id_daftar` = `pendaftaran`.`id_daftar`)
                                              AND    ( 
                                                            `rekam_medis`.`rekomendasi_lab` = _latin1'Ya')))),_utf8'Sudah Diperiksa',_utf8'Cek Laboratorium')) AS `if((select id_daftar from rekam_medis where id_daftar = pendaftaran.``id_daftar``) is null,'belum diperiksa',if((select id_daftar from rekam_medis where id_daftar = pendaftaran.``id_daftar`` and rekomendasi_lab = 'ya') is null,'sudah diperiksa','cek laboratori`) AS `keterangan`, 
                  `pendaftaran`.`tgl` AS `tgl` 
           FROM   (`pendaftaran` 
           JOIN   `pasien` 
           ON    (( 
                                `pendaftaran`.`id_pasien` = `pasien`.`id_pasien`))))$$ 
    delimiter ;

0 个答案:

没有答案