SQL执行报错:Unknown column ‘xxx’ in ‘on clause’
经核查发现是因为我用的是一个子查询,然后left join 关联查询的时候,没有把关联的条件在SELECT上查出来
错误案例
select * from store s left join (select max(amount) amount from receipt r ) t on t.storeCode=s.storeCode
这个时候就会报错
修正
select * from store s left join (select storeCode,max(amount) amount from receipt r ) t on t.storeCode=s.storeCode