首页 > 数据库技术 > 详细

26CRUD操作之inSQL---嵌套查询

时间:2021-09-24 00:37:50      阅读:28      评论:0      收藏:0      [点我收藏+]
 @Test
    void testInSQL(){
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.inSql("id", "select id from tb_user where id < 10");
        wrapper.inSql("age", "select age from tb_user where age > 3");
        System.out.println(userMapper.selectList(wrapper));
    }

sql语句如下
SELECT id,username,password,name,age,email,create_time,update_time,version,status,parentage,del FROM tb_user WHERE del=0 AND (id IN (select id from tb_user where id < 10) AND age IN (select age from tb_user where age > 3))

26CRUD操作之inSQL---嵌套查询

原文:https://www.cnblogs.com/morehair/p/15310193.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!