CREATE PROCEDURE `spAlertStudentReminderData` ( IN `P_Template` VARCHARACTER (?) , IN `P_MailSubject` VARCHARACTER (?) ) BEGIN SELECT ? AS `BatchId` , ? AS `BatchName` , `S` . `Id` , `T` . `UserId` AS `UserId` , `U` . `MobileNo` , `IFNULL` ( `S` . `EmailId` , ? ) AS `EmailId` , REPLACE ( REPLACE ( `P_Template` , ? , `U1` . `Name` ) , ? , `U` . `Name` ) AS `MsgText` , `P_MailSubject` AS SUBJECT , `U` . `name` AS `UserName` , ? AS `ReceiverRoleTypeId` , `S` . `Id` AS `ReceiverSourceId` , `S` . `UserId` AS `ReceiverUserId` , `T` . `InstituteId` AS `InstituteId` FROM `tinstitute` `I` LEFT JOIN `tteacher` `T` ON `I` . `Id` = `T` . `InstituteId` LEFT JOIN `tstudent` `S` ON `T` . `InstituteId` = `S` . `InstituteId` LEFT JOIN `tuser` `U` ON `S` . `UserId` = `U` . `Id` LEFT JOIN `tuser` `U1` ON `T` . `UserId` = `U1` . `Id` WHERE `S` . `StatusId` = ? ; END 