Union Query in Mysql

$query = “( SELECT DATE_FORMAT( Date, ‘%m/%d/%Y’ ) AS date_time, id, type, ‘notes’ as table_name FROM notes WHERE p_id =’”.$pid.”‘ ) UNION ( SELECT DATE_FORMAT( DOS, ‘%m/%d/%Y’ ) AS date_time, id, type, ‘mt_d’ as table_name FROM mt_d WHERE p_id =’”.$pid.”‘ ) UNION ( SELECT DATE_FORMAT( created, ‘%m/%d/%Y’ ) AS date_time, id, type, ‘docs’ as table_name … Read more