Is it better to have like twenty separate queries like SELECT id FROM table WHERE value = 'hello'
and then combine everything in a single 1 dimensional array in php or one huge query like
SELECT `t1`.`id` FROM (SELECT `id` FROM `table` WHERE `value` = 'hello') AS `t1`
LEFT JOIN (SELECT `id` FROM `table` WHERE `value` = 'world') AS `t2`
ON `t1`.`id` = `t2`.`id`
...
UNION ALL
SELECT `t1`.`id` FROM (SELECT `id` FROM `table` WHERE `value` = 'hello') AS `t1`
RIGHT JOIN (SELECT `id` FROM `table` WHERE `value` = 'world') AS `t2`
ON `t1`.`id` = `t2`.`id`
...
and so on until I've managed to join the results from all twenty sources?