标签:str 技术分享 when 数学 sele png result bsp ash
SELECT user_name , MAX(CASE course WHEN ‘数学‘ THEN score END ) 数学, MAX(CASE course WHEN ‘语文‘ THEN score END ) 语文, MAX(CASE course WHEN ‘英语‘ THEN score END ) 英语 FROM test_tb_grade GROUP BY USER_NAME;
<select id="list" resultType="java.util.HashMap"> SELECT user_name , <if test="courses != null"> <foreach collection="courses " item="item" separator=","> MAX(CASE course WHEN #{item} THEN score END ) "${item}" </foreach> </if> FROM test_tb_grade GROUP BY USER_NAME; </select>
标签:str 技术分享 when 数学 sele png result bsp ash
原文地址:https://www.cnblogs.com/moxiaotao/p/10070793.html