I am trying to join two tables and in both tables I have 2 same column names like agent_id and date both tables have agent_id and date actually I join tables based on agent_id a
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.