Mybatis外内连接的crud(含demo)(未写完)

查询

1.将需要查询的属性封装成pojo类

 2.mapper文件就按照正常sql写,如果需要参数查询,就加@Param注解,

<mapper namespace="com.xiaosuda.boot.Dao.StudentDao">
    <select id="SearchInf" resultType="com.xiaosuda.boot.Pojo.StudentInf">
        SELECT  student.sname as name,
                student.sbirth as birthday,
                student.sgender as gender,
                f1.Chinese,
                f1.ChineseScore,
                f1.Math,
                f1.MathScore
        FROM
            (
            SELECT
            t1.sid,t1.course as chinese,t1.score as chinesescore,t2.course as math,t2.score as mathscore
            FROM
                (
                    SELECT result.sid,class.course,result.score FROM class INNER JOIN result ON class.cid = result.cid WHERE class.cid = 1
                ) t1
            INNER JOIN
                (
                    SELECT result.sid,class.course,result.score FROM class INNER JOIN result ON class.cid = result.cid WHERE class.cid = 2
                ) t2
            WHERE
                t1.sid = t2.sid
            )f1
        INNER JOIN
            student
        ON
            f1.sid = student.sid
        where
        mathscore > chinesescore
    </select>
</mapper>

修改

UPDATE aa_user
INNER JOIN aa_order ON aa_user.u_id = aa_order.u_id 
SET aa_order.to_tal = 100 
WHERE
	aa_user.user_name = '李四'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值