mercredi 30 septembre 2015

It error "Subquery returns more than 1 row"

SELECT stdId,
       stdCodeId,
       tnName,
       stdFname,
       stdLname,
       stdClsId,
       stdScId,
       stdYearId,
       stdTermId,
       srId,
       srStatus,
       srUnitId,
       IF(srStatus='2',
            (SELECT chgWithdraw
             FROM nbs_financial.fin_chargeFee
             WHERE nbs_register.rg_student.stdScId = nbs_financial.fin_chargefee.chgScId),IF(srStatus='1',
                                                                                               (SELECT chgWithdraw
                                                                                                FROM nbs_financial.fin_chargeFee
                                                                                                WHERE nbs_register.rg_student.stdScId = nbs_financial.fin_chargefee.chgScId), IF(srStatus='0', IF(stdClsId='3',
                                                                                                                                                                                                    (SELECT chgNotWithdraw
                                                                                                                                                                                                     FROM nbs_financial.fin_chargeFee
                                                                                                                                                                                                     WHERE nbs_register.rg_student.stdScId = nbs_financial.fin_chargefee.chgScId
                                                                                                                                                                                                       AND chgStatus = '1'),
                                                                                                                                                                                                    (SELECT chgNotWithdraw
                                                                                                                                                                                                     FROM nbs_financial.fin_chargeFee
                                                                                                                                                                                                     WHERE nbs_register.rg_student.stdScId = nbs_financial.fin_chargefee.chgScId
                                                                                                                                                                                                       AND chgStatus = '0')),NULL))) AS amount
FROM nbs_register.rg_student
LEFT JOIN nbs_financial.fin_statusreimburse ON nbs_register.rg_student.stdId = nbs_financial.fin_statusreimburse.srStdId
LEFT JOIN nbs_controltemplate.titlename ON nbs_register.rg_student.stdTnId = nbs_controltemplate.titlename.tnId
WHERE stdYearId = '3'
  AND stdTermId = '1'
  AND stdScId = '21'
  AND stdRoomId = '34'   

I don't know where is problem.

Aucun commentaire:

Enregistrer un commentaire