Scenario: We have a table where we store our data but also we got some data from an external API. It is possible, to append this external data to our query results so to be able to apply WHERE and ORDER BY conditon. Example:
$a = array(array('RegDate' => '02-10-2018',
'JobTitle' => 'Web Designer'
),
array('RegDate' => '03-10-2018',
'JobTitle' => 'Account Manager'
),
array('RegDate' => '01-10-2018',
'JobTitle' => 'Web Designer'
),
...
);
$SQL = SELECT RegDate, JobTitle, CandidateName UNION ALL SELECT $a[]['RegDate'] ,$a[]['JobTitle'] WHERE JobTitle LIKE '%Account%' ORDER BY RegDate DESC
You would probably, deleguate your logic to php instead of MySQL here. Retrieve data from Database then append external data to it: