Page 1 of 1

Issue with Query

Posted: Sun Nov 23, 2014 5:53 pm
by TonsOfFun
I am using Codeigniter and this is the query it generate:

Code: Select all

 SELECT *
FROM (`employees`)
WHERE `position` = 1
OR `position` = 3
AND `status` = 1
ORDER BY `position` desc  
For some reason that I cannot figure out, it ignores the status = 1.

Is there anything wrong with the query that I am not seeing?

:banghead:

Re: Issue with Query

Posted: Sun Nov 23, 2014 6:27 pm
by Benjamin

Code: Select all

SELECT
  *
FROM
  employees
WHERE
  (position = 1 OR position = 3)
  AND status = 1
ORDER BY
  position desc