mybatis foreach时加表别名
时间: 2023-10-17 15:25:25 浏览: 151
在MyBatis中使用foreach标签时,可以通过给表名添加别名来实现。在foreach标签中,可以使用as关键字为表名添加别名。例如,如果要给表名为product_的表添加别名,可以使用以下语法:
SELECT * FROM product_ AS p WHERE ID in <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> #{item} </foreach><span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [MyBatis foreach 标签常用方法总结](https://blog.csdn.net/piaoranyuji/article/details/128187911)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [MyBatis foreach标签](https://blog.csdn.net/m0_53698336/article/details/120541001)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文