I have view that read data from different table in one database now I want to use sum function to sum the total amount that I link with one project code and group by the project code below is the query that I tried challenge that am experiencing now is when am running this query want me to pull all the field that I want to select on the group by off which what I want is to group with one field which is the project code "
".hopping am clear can you please assist.
What I have tried:
SELECT [Advise no], sum(Amount) as Amounts,PaymentDate AS Date, Description,
[Project Type], [Sub Project Type], [Arms of Services], dbo.VIEW_FacilityBasicInfo.Programme,
dbo.VIEW_FacilityBasicInfo.[Sub-Programme], dbo.VIEW_FacilityBasicInfo.[Facility Number], dbo.VIEW_FacilityBasicInfo.[Facility Name],
dbo.VIEW_FacilityBasicInfo.[DEP Act Item No], dbo.DPW_Payments.[WCS no], dbo.DPW_Payments.[Project Description], dbo.DPW_WCSFacilityID.FacilityID,
dbo.DPW_Payments.PaymentIdentifier, dbo.DPW_Payments.[Bas Fund Description]
FROM dbo.DPW_WCSFacilityID INNER JOIN
dbo.VIEW_FacilityBasicInfo ON dbo.DPW_WCSFacilityID.FacilityID = dbo.VIEW_FacilityBasicInfo.[Facility Number] RIGHT OUTER JOIN
dbo.DPW_Payments ON dbo.DPW_WCSFacilityID.WCS = dbo.DPW_Payments.[WCS no] LEFT OUTER JOIN
dbo.DPW_WCSDescription ON dbo.DPW_Payments.[WCS no] = dbo.DPW_WCSDescription.WCS
WHERE [Bas Fund Description] = 'DEF-A&L'
Group by [WCS no