Cause: The two tables join when the field is not supported two tables of non-equal operation.
Solution:
1, the unequal conditions to get the where clause
select ... from
class_order t1
left join class_order_refund t2 on t1.orderdate>t2.orderdate
It can be rewritten as
select ... from
class_order t1
left join class_order_refund t2
where t1.orderdate>t2.orderdate
2, if the first method is not applicable, based on the select field
select
...
if(t1.orderdate>t2.orderdate,0,1) as is_refund
...
from
class_order t1
left join class_order_refund t2 on t1.orderdate>t2.orderdate
Blog address: http://www.jouypub.com
Jane book Home: https://www.jianshu.com/u/756c9c8ae984
segmentfault Home: https://segmentfault.com/blog/jouypub
Tencent cloud Home: HTTPS: / /cloud.tencent.com/developer/column/72548