子选择查询中的HQL限制 [英] HQL limit in subselect query

查看:100
本文介绍了子选择查询中的HQL限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据某些条件将一个表的外键插入另一个表.结构就像

I want to insert foreign key of one table in another on basis of certain criteria. Structure is like

insert into CustomerResult(customer,draw) select c.idCustomer, from Customer c,Draw d where ..... and  c.idCustomer in (select cc.idCustomer from Customer cc where ..... limit 10)

在这里,我只想插入不符合特定条件的记录的修订.我知道hql没有limit关键字,但想实现这样.有什么建议吗?

here i want to insert only fix no of records which fulfill certain criteria. I know hql has no limit keyword but want to implement like this. any suggestion?

推荐答案

我不认为Hibernate直接支持您要执行的操作(在子查询中使用limit).看看这些以前的答案:

I don't think that what you want to do (use limit in subquery) is directly supported by Hibernate. Have a look at these previous answers:

  • How to set a limit to inner query in Hibernate?
  • How do you do a limit query in HQL?

这篇关于子选择查询中的HQL限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆