mysql 多个left join 怎么优化

2024-12-25 19:33:16
推荐回答(1个)
回答1:

收藏(1)
sql语句如下:
SELECT udd.id,udd.doTime,udd.doType,udd.isOk,udd.resourceId,
udd.userId,uu.alias userName,uu.email AS email,bd.nid AS drugId,bd.drug_name_en AS drugName
FROM udl_drugs_downlaod_log udd LEFT
JOIN use_user uu ON udd.userId=uu.id
LEFT JOIN report rt ON rt.id=udd.resourceId
LEFT JOIN base_msg bd ON bd.nid=rt.drugId
WHERE 1=1
ORDER BY doTime DESC
LIMIT 0,10