Instead of running hundreds of SELECT queries for one operation, I want to just run one big query, which I'm hoping will ease the load on my server.
SELECT (
(SELECT link_type_id FROM connections WHERE (node_to_id = '0' AND node_from_id = '1') OR (node_from_id = '1' AND node_to_id = '0')),
(SELECT link_type_id FROM connections WHERE (node_to_id = '0' AND node_from_id = '2') OR (node_from_id = '2' AND node_to_id = '0'))
)
There will be many more SELECTS in this query, but even the two aren't working. When I run this code I get the error:
Operand should contain 1 column(s).
Any suggestions? Thanks!
UNION SELECTand lose the outerSELECT, it won't really be that much more efficient though.(node_to_id = '0' AND node_from_id = '1') OR (node_from_id = '1' AND node_to_id = '0')doesnt seem to differ.. both options are the same