In mysql, you can execute a less strict group by statement, you can get a seemingly normal result.
select c1,c2,c3,sum(c4) from table1 ;
At this time, if you perform union all on multiple results, mysql will directly discard part of the result set, causing very strange problems.
Such as
select c1,c2,c3,sum(c4) from table1
group by c1,c2,c3
union all
select c1,c2,c3,sum(c4) from table2
At this point, the result set of table2 will be discarded, but in fact table2 contains data that meets the business meaning.
Therefore, writing SQL must strictly follow the SQL syntax.