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
Post a Comment