日期:2014-05-17 浏览次数:20828 次
SELECT origin FROM game_user WHERE plat_name='gamedp' AND game_name='dc2' AND area_name='一服' UNION SELECT origin FROM game_user WHERE plat_name='gamedp' AND game_name='dc2' AND area_name='二服' UNION SELECT origin FROM game_user WHERE plat_name='gamedp' AND game_name='dc2' AND area_name='s1'
<select id="queryOrigin" parameterType="java.lang.String" resultType="com.aiyounet.gas.service.bean.GameUser"> <foreach collection="array" item="areaName" open="(" separator="," close=")"> SELECT DISTINCT origin AS origin,id AS id FROM game_user WHERE plat_name=#{platName} AND game_name=#{gameName} AND area_name=#{areaName} <if test=" array.length >1 "> UNION </if> </foreach> </select> 这样写可以不?