我一直很疑惑一个问题就是,怎样判断这个查询语句中是否一定会做笛卡尔积,我也做了表之间的关联,可能关联的不全也不知道怎么回事,怎么避免这种情况呢?我把控制台打印sql复制如下,哪位大牛了解的给小弟解析下,千恩万谢,我已经困惑很久了。
select
tkcbh0_.KCBHID as KCBHID38_,
tkcbh0_.CKDID as CKDID38_,
tkcbh0_.CKRK as CKRK38_,
tkcbh0_.CREATEDBY as CREATEDBY38_,
tkcbh0_.CREATEDTIME as CREATEDT3_38_,
tkcbh0_.CRKSJ as CRKSJ38_,
tkcbh0_.CRKSL as CRKSL38_,
tkcbh0_.CZR as CZR38_,
tkcbh0_.DElETEDBY as DElETEDBY38_,
tkcbh0_.DELETEDFLAG as DELETEDF6_38_,
tkcbh0_.DELETEDTIME as DELETEDT7_38_,
tkcbh0_.MODIFIEDBY as MODIFIEDBY38_,
tkcbh0_.MODIFIEDTIME as MODIFIED8_38_,
tkcbh0_.RKDID as RKDID38_,
tkcbh0_.WZID as WZID38_
from
t_kcbh tkcbh0_,
T_CKD tckd1_,
t_rkd trkd2_
where
(
tkcbh0_.DELETEDFLAG=0
)
and(
(
tckd1_.DJBH like '%6%' escape '/'
and tkcbh0_.CKDID=tckd1_.CKDID
)
OR(
trkd2_.DJBH like '%6%' escape '/'
and tkcbh0_.RKDID=trkd2_.RKDID
)
)
and(
tkcbh0_.WZID='2c9081e83e49e824013e49ec1c620022'
)
今天写了一个hql作查询,结果查询出很多条重复的记录,肯定做了笛卡尔积
答案:2 悬赏:40 手机版
解决时间 2021-02-14 13:17
- 提问者网友:献世佛
- 2021-02-14 07:23
最佳答案
- 五星知识达人网友:执傲
- 2021-02-14 08:31
from t1,t2,t3..tn这就是笛卡尔积
t1表总记录乘以t2表总记录乘以t3表总记
t1表总记录乘以t2表总记录乘以t3表总记
全部回答
- 1楼网友:第幾種人
- 2021-02-14 09:33
期待看到有用的回答!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯