UPDATE SELECT操作 在mybatis里为什么放在<select>标签里? 20
mybatis的XML文件里SQL如下:为什么放在select标签里,而且无返回值?求SQL大神解释。<selectid="setFaltCountByResourceI...
mybatis的XML文件里SQL如下: 为什么放在select标签里,而且无返回值?求SQL大神解释。
<select id="setFaltCountByResourceId">
UPDATE ts_testfalttree INNER JOIN (
SELECT sectionResourceId, leveCode, count(exerciseId) faultNum FROM (
SELECT ts_testfaltdetail.exerciseId, sr.sectionResourceId,sr.leveCode
FROM (select * from ts_testfaltdetail where studentId = #{studentid,jdbcType=BIGINT} ) ts_testfaltdetail right join (
SELECT sr2.sectionResourceId,sr2.levecode
FROM ts_studyresource sr1,ts_studyresource sr2
WHERE sr1.sectionResourceId = #{sectionresourceid,jdbcType=BIGINT}
AND LEFT(sr1.leveCode ,5) = LEFT(sr2.leveCode,5)) sr
ON sr.sectionResourceId = ts_testfaltdetail.sectionResourceId
) a
group by sectionResourceId ) b
ON ts_testfalttree.sectionResourceId = b.sectionResourceId
SET ts_testfalttree.faltCount = b.faultNum
</select> 展开
<select id="setFaltCountByResourceId">
UPDATE ts_testfalttree INNER JOIN (
SELECT sectionResourceId, leveCode, count(exerciseId) faultNum FROM (
SELECT ts_testfaltdetail.exerciseId, sr.sectionResourceId,sr.leveCode
FROM (select * from ts_testfaltdetail where studentId = #{studentid,jdbcType=BIGINT} ) ts_testfaltdetail right join (
SELECT sr2.sectionResourceId,sr2.levecode
FROM ts_studyresource sr1,ts_studyresource sr2
WHERE sr1.sectionResourceId = #{sectionresourceid,jdbcType=BIGINT}
AND LEFT(sr1.leveCode ,5) = LEFT(sr2.leveCode,5)) sr
ON sr.sectionResourceId = ts_testfaltdetail.sectionResourceId
) a
group by sectionResourceId ) b
ON ts_testfalttree.sectionResourceId = b.sectionResourceId
SET ts_testfalttree.faltCount = b.faultNum
</select> 展开
1个回答
TableDI
2024-07-18 广告
2024-07-18 广告
在Excel中,使用`VLOOKUP`函数进行单一条件查找非常常见,但`VLOOKUP`本身并不直接支持双重条件。然而,你可以通过一些间接方法实现。一种方法是将两个条件合并为一个标识符(例如,通过连接或串联),然后在另一个区域中查找此标识符...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询