Declare @Bu nvarchar(36);
SET @Bu='84b7a65c-3e43-e511-80ca-005056af12ea'
SELECT CertificateID,
CertDate,
asia_personalcode AS prscode,
FullName AS prsname,
custom_CertificateCourses.CourseName,
Courselength,
custom_certificateTrainingCenter.TrainingName
FROM Custom_BusinessUnit RIGHT OUTER JOIN
CMS_User ON Custom_BusinessUnit.BusinessUnitId = CMS_User.BusinessUnitId RIGHT OUTER JOIN
custom_certificateTrainingCenter RIGHT OUTER JOIN
custom_certificate ON custom_certificateTrainingCenter.CertificateTrainingCenterID = custom_certificate.Trainingname LEFT OUTER JOIN
custom_CertificateCourses ON custom_certificate.CourseName = custom_CertificateCourses.CertificateCoursesID ON CMS_User.UserID = custom_certificate.prscode
WHERE (Custom_BusinessUnit.BusinessUnitId IN (SELECT BusinessUnitId FROM Custom_BusinessUnit AS Custom_BusinessUnit_3 WHERE (ParentBusinessUnitId IN (SELECT BusinessUnitId FROM Custom_BusinessUnit AS Custom_BusinessUnit_2 WHERE (ParentBusinessUnitId IN (SELECT BusinessUnitId FROM Custom_BusinessUnit AS Custom_BusinessUnit_1 WHERE (ParentBusinessUnitId = @bu) OR (BusinessUnitId = @bu))) OR (ParentBusinessUnitId = @bu) OR (BusinessUnitId = @bu))) OR (ParentBusinessUnitId = @bu) OR (BusinessUnitId = @bu))) AND(UserEnabled = '1') AND (UserType = 1) AND (DevelopManagerFlag = 1) AND (AssistanceDevelopFlag = 1)
ORDER BY prscode
this is my query pls help me