更新时间:2022-12-17 15:43:46
SELECT sr.*,pm.paid
FROM `sales_report` as sr
INNER JOIN `payments` as pm
ON sr.`agent_id`=pm.`agent_id`
ORDER BY sr.date, pm.date
从第一张表中获取日期,并在第一张表中的日期之前获得订单,然后在第二张表中的日期开始订购.
Will get you date from first table and order by 1st table date then 2nd table date.