I want to get the query result that contains all entries from array and some data from the DB.
It's like the array is a DB table and by left join
I connect the data that I need.
I've solved this task in a clumsy way and am asking for tips on how to rewrite this solution.
Here is my query:
$subquery = 'Select \'' .
implode('\' as id union Select \'', $var_array) . '\'';
$query = "Select tmp.variable,
fields.content is NULL as content FROM ({$subquery}) tmp
LEFT JOIN fields
ON tmp.id= fields.id";