MySQL Multiple Select, Multiple Where Clauses

mysql, select

Solution

You can try below may be but you may need `UNION`

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')
UNION
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')

Problem

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!

Original source