I have a table and column containing date
(say in string). I need to get two columns such as countin(2020)
and countin(2019)
from the same date column such that date is like '2020%' or '2019%' and I want them as separate columns.
My query is kind of like this.
select C.pin_code, count(distinct(C.customer_code)) as 2020
from table
group by C.pin_code
My output is this
For me there should be another column beside 2020 called 2019 which give same data as 2020 in year 2019.
If I have under emphasized something, please let me know in the comments.