select 
brand_id,
sum(sales_amount) total_sales_amount,
sum(sales_quantity) total_sales_quantity,
round(avg(satisfaction_score),2) avg_satisfaction_score
from sales_data s 
join customer_feedback c on s.sales_id=c.sales_id
where sales_month between '2023-01' and '2023-12'
#where year(sales_month)='2023'
group by brand_id
order by brand_id

不能直接用year而是要用between and

本质问题:函数 year() 对字段类型有严格要求,而表中 sales_month 实际是字符串,需用字符串操作替代日期函数。