MySQL Multiple Select, Multiple Where Clauses -


instead of running hundreds of select queries 1 operation, want run 1 big query, i'm hoping ease load on server.

select ( (select link_type_id connections (node_to_id = '0' , node_from_id = '1') or (node_from_id = '1' , node_to_id = '0')), (select link_type_id connections (node_to_id = '0' , node_from_id = '2') or (node_from_id = '2' , node_to_id = '0')) ) 

there many more selects in query, 2 aren't working. when run code error:

operand should contain 1 column(s). 

any suggestions? thanks!

you can try below may may need union

select link_type_id connections  (node_to_id = '0' , node_from_id = '1')  or (node_from_id = '1' , node_to_id = '0') union select link_type_id connections  (node_to_id = '0' , node_from_id = '2')  or (node_from_id = '2' , node_to_id = '0') 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -