In this step by step SQL Tutorial I will show you how to using SQL Group by Year from date field and use aggregate function. For the purpose of this tutorial I will use SQL Server 2012.
Prior knowledge: It might be easier for you to follow this tutorial if you have knowledge of Aggregate functions and Group by for more information visit SQL Group By.
We are going to show you how to use Year and Sum aggregate function with Group by this knowledge might help with questions like
how to get Total sales amount for each year. In the following example I will show you how you could write the query.
Below I use Year function with ShipDate field and display new column as SalesYear in SELECT then I use group by with Year on ShipDate field.
To get full access to this page
Become a member or Sign in
Membership is just $3.99/month