select A.RegistrationI d,B.CustomerNam e,ServiceNo as ServiceNo,conve rt(varchar(20), OrderDate,110) OrderDate,
D.ProductName,E .ServiceName,co nvert(varchar(2 0),C.DeliveryDa te,110) DeliveryDate
from TBL_ServiceRegi stration A
left OUTER JOIN TBL_CustomerMas ter B on A.CustomerId=B. CustomerId
left outer JOIN TBL_ServiceRegi stration_Detail s C on A.RegistrationI d=C.Registratio nId
left outer JOIN TBL_ProductMast er D ON C.ProductId=D.P roductId
left OUTER JOIN TBL_ServiceEntr y E on C.ServiceId=E.S erviceId
where (@ServiceId=0 OR A.RegistrationI d=@ServiceId) and (@CustomerId=0 OR A.CustomerId=@C ustomerId)
D.ProductName,E .ServiceName,co nvert(varchar(2 0),C.DeliveryDa te,110) DeliveryDate
from TBL_ServiceRegi stration A
left OUTER JOIN TBL_CustomerMas ter B on A.CustomerId=B. CustomerId
left outer JOIN TBL_ServiceRegi stration_Detail s C on A.RegistrationI d=C.Registratio nId
left outer JOIN TBL_ProductMast er D ON C.ProductId=D.P roductId
left OUTER JOIN TBL_ServiceEntr y E on C.ServiceId=E.S erviceId
where (@ServiceId=0 OR A.RegistrationI d=@ServiceId) and (@CustomerId=0 OR A.CustomerId=@C ustomerId)
Comment