mybatis中sql语句对比
连接的是pgsql数据库,
第一种写法,一直报错“Must have sharding column with subquery”:
select
t1.data,
t1.prov_code,
(case when t2.data_no is not null then '01' else '00' end) modifiable
from tbl_info t1
left join
( select t3.data_no, t3.type from tbl_dic t3 where t3.type = '001') t2 on t1.prov_code = t2.data_no
where t1.date = '20240508'
第二种写法,可以正常执行
select
t1.data,
t1.prov_code,
(case when t2.data_no is not null then '01' else '00' end) modifiable
from tbl_info t1
left join tbl_dic t2 on t1.prov_code = t2.data_no and t2.type = '001'
where t1.date = '20240508'
但是我感觉两种意思是一样的,在dbever也都能正常执行,可是放进mybatis里执行效果却大不相同,想知道为什么