MYSQL关联视图查询数据慢

将视图定义代码直接写入查询语句

select *
	,concat(man_mobile1,' ',man_mobile2,' ',man_mobile3) as man_mobile
from `car`
join `company` on car_company_id=company_id
left join `man` on car_master_id=man_id
left join `buy` on buy_car_id=car_id
left join `loan` on loan_car_id=car_id
left join `bank` on loan_bank_id=bank_id
left join (
	select *
	from `filelog`
	where filelog_id in (select max(filelog_id) from `filelog` group by filelog_car_id)
) as v_filelog on filelog_car_id=car_id
left join (
	select *
	from `hock`
	where hock_id in (select max(hock_id) from `hock` group by hock_car_id)
) as v_hock on hock_car_id=car_id
where car_status=1

你可能感兴趣的:(MYSQL)