近期研究水平分表,根据mysql的事件和存储过程,实现了定期创建分表,但是查询的时候遇到个问题,
跨表时sql查询的问题
后来查到了mysql的union详情可参考:连接
最终结果可参考下面的sql
<select id="queryRatingInfo" resultType="***">
<foreach collection="ratingList" item="item" index="index" open="" separator="UNION " close="">
SELECT ***, ***, ***, ***, ***
FROM e_rating_info
WHERE rating_quantity <> 0
AND country_code = #{item.***}
AND asin = #{item.***}
</foreach>
ORDER BY *** DESC;
</select>