今天看到 hibernate 的find方法打印的sql语句,很奇怪,为什么一个select语句可以嵌入另一select语句
from里面呢,我知道的这种情况应该是子查询,不都应该嵌入到where查询条件中的吗?有懂的大牛帮我解析一下啊,感激不尽!控制台答应的语句如下:Hibernate:sel...
from里面呢,我知道的这种情况应该是子查询,不都应该嵌入到where查询条件中的吗?有懂的大牛帮我解析一下啊,感激不尽!
控制台答应的语句如下:
Hibernate:
select
*
from
( select
distinct tkcbh0_.KCBHID as KCBHID36_,
tkcbh0_.CKDID as CKDID36_,
tkcbh0_.CKRK as CKRK36_,
tkcbh0_.CREATEDBY as CREATEDBY36_,
tkcbh0_.CREATEDTIME as CREATEDT3_36_,
tkcbh0_.CRKSJ as CRKSJ36_,
tkcbh0_.CRKSL as CRKSL36_,
tkcbh0_.CZR as CZR36_,
tkcbh0_.DElETEDBY as DElETEDBY36_,
tkcbh0_.DELETEDFLAG as DELETEDF6_36_,
tkcbh0_.DELETEDTIME as DELETEDT7_36_,
tkcbh0_.MODIFIEDBY as MODIFIEDBY36_,
tkcbh0_.MODIFIEDTIME as MODIFIED8_36_,
tkcbh0_.RKDID as RKDID36_,
tkcbh0_.WZID as WZID36_
from
t_kcbh tkcbh0_
where
(
tkcbh0_.DELETEDFLAG=0
)
and(
tkcbh0_.WZID=?
)
order by
tkcbh0_.CRKSJ desc )
where
rownum <= ? 展开
控制台答应的语句如下:
Hibernate:
select
*
from
( select
distinct tkcbh0_.KCBHID as KCBHID36_,
tkcbh0_.CKDID as CKDID36_,
tkcbh0_.CKRK as CKRK36_,
tkcbh0_.CREATEDBY as CREATEDBY36_,
tkcbh0_.CREATEDTIME as CREATEDT3_36_,
tkcbh0_.CRKSJ as CRKSJ36_,
tkcbh0_.CRKSL as CRKSL36_,
tkcbh0_.CZR as CZR36_,
tkcbh0_.DElETEDBY as DElETEDBY36_,
tkcbh0_.DELETEDFLAG as DELETEDF6_36_,
tkcbh0_.DELETEDTIME as DELETEDT7_36_,
tkcbh0_.MODIFIEDBY as MODIFIEDBY36_,
tkcbh0_.MODIFIEDTIME as MODIFIED8_36_,
tkcbh0_.RKDID as RKDID36_,
tkcbh0_.WZID as WZID36_
from
t_kcbh tkcbh0_
where
(
tkcbh0_.DELETEDFLAG=0
)
and(
tkcbh0_.WZID=?
)
order by
tkcbh0_.CRKSJ desc )
where
rownum <= ? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询