CREATE PROCEDURE `spGroupParticipantsList` ( IN `P_ChatGroupId` INTEGER ) BEGIN SELECT `CG` . `Id` AS `GroupId` , `CG` . `Title` AS `GroupName` , `CG` . `BatchId` AS `BatchId` , `ifnull` ( `CG` . `CreatedDateTime` , ? ) AS `CreatedDateTime` , `B` . `Title` AS `BatchName` , `B` . `TeacherId` AS `ParticipantSourceId` , `U1` . `Id` AS `ParticipantId` , `U1` . `Name` AS `ParticipantName` , `U1` . `RoleTypeId` AS `ParticipantRoleTypeId` FROM `tchatgroupmaster` `CG` INNER JOIN `tbatch` `B` ON `B` . `Id` = `CG` . `BatchId` INNER JOIN `tteacher` `T` ON `T` . `Id` = `B` . `TeacherId` INNER JOIN `tuser` `U1` ON `U1` . `Id` = `T` . `UserId` WHERE `CG` . `Id` = `P_ChatGroupId` UNION SELECT `CG` . `Id` AS `GroupId` , `CG` . `Title` AS `GroupName` , `CG` . `BatchId` AS `BatchId` , `ifnull` ( `CG` . `CreatedDateTime` , ? ) AS `CreatedDateTime` , `B` . `Title` AS `BatchName` , `AB` . `StudentId` AS `ParticipantSourceId` , `U1` . `Id` AS `ParticipantId` , `U1` . `Name` AS `ParticipantName` , `U1` . `RoleTypeId` AS 