SELECT Sum(RequestAmount) from Transactions MT INNER JOIN User_Heirarchy_Details UHD on MT.UserID=UHD.UserID WHERE UHD.ParentUserID IN (select ParentUserID from User_Heirarchy_Details where UserID = 38 ) and Datepart(MM,MT.CreatedDate )=dATEPART(MM,getdate()) AND Datepart(YYYY,MT.CreatedDate )=dATEPART(YYYY,getdate()) and MT.[Status] in ('SUCCESS','PENDING')
i can able to get data upto where userid=38 but when i try to filter with using datepart it is not giving any values but im having data related to date ranges pls help me to fix it