Dev Dev - 1 year ago 97
SQL Question

MYSQL Database Query not giving back expected results

I have a database which has the configuration as shown in the picture
Config of Database Table

I am trying to query

SELECT * FROM emails WHERE ('from_type=Manager' OR 'to_type=Manager') AND ('from=2' OR 'to=2')

It is giving me back a blank result, even though I think it should give me the one query I have set,

enter image description here

Answer Source

Try this Code and let me know if you get your Desired Output.

SELECT * FROM emails 
WHERE (`from_type`= 'Manager' OR `to_type`='Manager') AND (`from`='2' OR `to`='2')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download