做SQL统计报表的时候,调试报错如下:
Msg 205, Level 16, State 1, Line 1
All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.
说明:select *from table_A union [all] select *from table_B
解决方案:联合查询union [all] 函数必须 table_A 与 table_B 的列字段数量一致
比如table_A有5个字段,table_B有3个字段,使用union all会出现如上错误提示