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 * FROM ( SELECT sr.date FROM `sales_report` as sr UNION SELECT pm.date FROM `payments` as pm ) ORDER BY date
I think this is what you wanted,Both sales_report and payments need be considered as a table.then sort it.
sales_report
payments