@ 2018-08-26T21:26:29Z <?php
$array_table_name = [
'table_1',
'table_2',
'table_3',
];
$search_id = 1;
$selectsArray = [];
foreach ($array_table_name as $table_name) {
$selectsArray[] = "SELECT * FROM $table_name WHERE id='$search_id'\n";
}
$selectsUnion = implode("UNION ALL\n", $selectsArray) . "ORDER BY date_added \nLIMIT 1";
echo $selectsUnion;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.1.0 - 7.1.21 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 , 8.4.1 - 8.4.12 SELECT * FROM table_1 WHERE id='1'
UNION ALL
SELECT * FROM table_2 WHERE id='1'
UNION ALL
SELECT * FROM table_3 WHERE id='1'
ORDER BY date_added
LIMIT 1 preferences:dark mode live preview ace vim emacs key bindings
151.79 ms | 408 KiB | 5 Q