下面这段sql是把两个表中各自符合条件的count值相加,返回结果是两个之和
SELECT sum(result) FROM ( SELECT COUNT(*) result FROM TEST_A WHERE name= #{param} OR desc= #{param} UNION ALL SELECT COUNT(*) result FROM TEST_B WHERE name= #{param} ) a