create table business_city (
business_date date,
city_id int
);
delete from business_city;
insert into business_city
values(cast('2020-01-02' as date),3),(cast('2020-07-01' as date),7),(cast('2021-01-01' as date),3),(cast('2021-02-03' as date),19)
,(cast('2022-12-01' as date),3),(cast('2022-12-15' as date),3),(cast('2022-02-28' as date),12);
with cte as
(
select city_id,year(min(business_date)) as start_dt
from business_city
group by city_id
)
select start_dt, count(city_id) from cte
group by start_dt
order by 1
To embed this project on your website, copy the following code and paste it into your website's HTML: