I have data in the table that contains the surcharge price of many carriers in many years. Each carrier will have 12 months.
CARRIER_ID  YEAR    MONTH   RATE
DHL         2021    April   16.5
DHL         2021    August  18.5
DHL         2021    December    0
DHL         2021    February    14
DHL         2021    January 12.5
DHL         2021    July    17.75
DHL         2021    June    17
DHL         2021    March   15
DHL         2021    May 17
DHL         2021    November    0
DHL         2021    October 0
DHL         2021    September   0
FedEx       2021    April   16.5
FedEx       2021    August  17.5
FedEx       2021    December    0
FedEx       2021    February    14.5
FedEx       2021    January 13.5
FedEx       2021    July    17.5
FedEx       2021    June    17
FedEx       2021    March   16
FedEx       2021    May 16.5
FedEx       2021    November    0
FedEx       2021    October 0
FedEx       2021    September   0
And I want to make a query in SQL server to get data like this.
Please note that: The data need to group by the year(exp: 2021)
Month   DHL FedEx
January 12.50%  13.50%
February14.00%  14.50%
March   15.00%  16.00%
April   16.50%  16.50%
May     17.00%  16.50%
June    17.00%  17.00%
July    17.75%  17.50%
August  18.50%  17.50%
September0  0
October 0   0
November0   0
December0   0
I did search in google but can not find the solution.
Pls give me how to do it.
Thank you so much.
 
    