mysql - sql query return wrong results -


why query returns results companyvisible 0, asking companies companyvisible has value of 1?

select c.companyid, c.companydescription , c.companyname ,c.copmanydrastiriotita, c.companyvisible company c c.companyvisible = 1 , c.companydescription '%keyword%' or c.companyname '%keyword%' or c.copmanydrastiriotita '%keyword%' 

because of or clause

apply brackets around and ...or clause

use this

select c.companyid, c.companydescription , c.companyname ,c.copmanydrastiriotita, c.companyvisible company c c.companyvisible = 1 , (c.companydescription '%keyword%' or c.companyname '%keyword%' or c.copmanydrastiriotita '%keyword%') 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -