i have 2 tables
ticket_message
msg_id(int)
created(date)
response_message
res_id(int)
created(date)
how can i merge the 2 tables so t
I don't think merge means join.
Join means you make two rows of each table into a bigger row based on some join condition. If you want to read all rows from one table then from another and then order them use the UNION operator then ORDERBY on the unioned set. Be warned, Union makes your indexes unusable, so Ordering can be quite slow!
So that'll be
(Select ticket_message as message, msg_id as id, created as created, "ticket" as type)
Union
(Select response_message as message, res_id as id, cread as created, "response" as type)
order by created
I've added a type column to make it easier to distinguish...