Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql数据库通过mycat分表,多表关联查询无结果 #2920

Open
cz-liu opened this issue Jul 22, 2022 · 1 comment
Open

mysql数据库通过mycat分表,多表关联查询无结果 #2920

cz-liu opened this issue Jul 22, 2022 · 1 comment

Comments

@cz-liu
Copy link

cz-liu commented Jul 22, 2022

描述你使用过程中遇到的问题: **
前提条件:
mycat-版本1.6.7.6,数据库-版本5.7.25,源码增加按年拆分规则代码打包。
使用中:
一个库对部分表进行按年拆分多张表,通过mycat 插入保存数据,查看逻辑库数据保存到拆分后的表中。
条件相同,单表查询OK,关联查询查不到值。
实例:
1.通过mycat连接查询,无结果
SELECT a.

FROM table_A a
LEFT JOIN table_B b ON b.id = a.id
WHERE a.create_time BETWEEN '2024-08-01 00:00:00' AND '2024-08-10 23:59:59'
2.通过原始数据库查询,结果正确
SELECT a.

FROM table_A_2024 a
LEFT JOIN table_B b ON b.id = a.id
WHERE a.create_time BETWEEN '2024-08-01 00:00:00' AND '2024-08-10 23:59:59'

请问以上问题应该怎么处理呢?

@cz-liu cz-liu changed the title 通过mycat多表关联查询无结果 mysql数据库通过mycat分表,多表关联查询无结果 Jul 22, 2022
@caofei996
Copy link

不在一个分片上的无法进行关联查询。建议使用水平拆分表,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants