MySQL如何连接两个字段上的表

2021-12-17 00:00:00 join mysql

我有两个带有 dateid 字段的表.我想加入这两个领域.我试过

I have two tables with date and id fields. I want to join on both fields. I tried

JOIN t2 ON CONCAT(t1.id, t1.date)=CONCAT(t2.id, t2.date)

可以,但是速度很慢.有没有更好的方法来做到这一点?

that works, but it is very slow. is there a better way to do this?

推荐答案

JOIN t2 ON t1.id=t2.id AND t1.date=t2.date

相关文章