I'm having trouble running/configuring a query for Microsoft SQL Server, the query is as follows:
SELECT
ps.WeekIncluded AS PaidWeeks,
PayD.PayDate AS PayDates,
ps.PayYear AS PYear,
months.PMonth,
(SELECT sum(DayPay) FROM Shifts GROUP BY WeekNumber)
FROM dbo.PayStructure ps
JOIN dbo.Months Months
ON ps.MonthID = months.ID
JOIN dbo.PayDates PayD ON ps.MonthID = PayD.MonthID
Group BY ps.MonthID
What this is trying to do, is create a view (not included in snippet) using three tables, including selecting the sum of DayPay in Shifts and GroupBy the week number to be later joined and joined by a weeknumber to the specified month. Unfortunately i'm getting:
Column 'dbo.PayStructure.WeekIncluded' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
& using:
SELECT
ps.WeekIncluded AS PaidWeeks,
PayD.PayDate AS PayDates,
ps.PayYear AS PYear,
months.PMonth,
(SELECT sum(DayPay) FROM Shifts)
FROM dbo.PayStructure ps
JOIN dbo.Months Months
ON ps.MonthID = months.ID
JOIN dbo.PayDates PayD ON ps.MonthID = PayD.MonthID
Returns:

Every selected is equal to: 60.36 where what i'm trying to get is:
Janurary - Null
February - Null
March - Null
April - Null
May - Null
June - Null
July - Null
August - Null
September - 60.36
October - Null
December - Null
Null being for 11/12 months due to having no data input for those week numbers/months
As Asked for.
Dbo.Shifts

Dbo.PayStructure

Dbo.Months

Attempted:
SELECT
ps.WeekIncluded AS PaidWeeks,
PayD.PayDate AS PayDates,
ps.PayYear AS PYear,
SUM(Sh.DayPay)
FROM dbo.PayStructure ps
LEFT JOIN dbo.Months Months
ON ps.MonthID = months.ID
LEFT JOIN dbo.PayDates PayD
ON ps.MonthID = PayD.MonthID
LEFT JOIN dbo.Shifts Sh
ON Sh.WeekNumber = ps.WeekIncluded
GROUP BY Sh.WeekNumber