Today i have below problem while perform an sql query. Please find below data.
I perform SQL query on my table and get the below resulted output. i perform Group by on ID, Name, Week, Year, Days now i want the Days column as average of All Days based on year column. means there is multiple value of year is exist so i need Avg of Days data in all rows of DAYS for particular row. expected result as per below.
Thanks in Advance!!!
Write in comment if you have any query.
You can use
SELECT *, AVG(Days) OVER (PARTITION BY LEFT(Year, 4)) AvgDays FROM Tbl
Note: Just grouped by year (2016)