按照你的写法,TM3.PRIC也要加到group by后面
select TM1.ID,"SUM"(TM1.数量)*TM3.PRICE,
'2020-12-31 00:00:00' DATE,
'2020' YEAR
from TM1
left join TM2 on TM1.编码=TM2.编码
left join TM3 on tm1.ID=TM3.ID
and TM1.编码=TM3.编码
WHERE TM1.ID='20201123'
GROUP BY TM1.ID,TM3.PRICE
但我觉得正确的写法应该是这样,把TM3.PRICE放到括号里面
select TM1.ID,"SUM"(TM1.数量*TM3.PRICE),
'2020-12-31 00:00:00' DATE,
'2020' YEAR
from TM1
left join TM2 on TM1.编码=TM2.编码
left join TM3 on tm1.ID=TM3.ID
and TM1.编码=TM3.编码
WHERE TM1.ID='20201123'
GROUP BY TM1.ID