Issue with Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Issue with Query

Post 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:
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Issue with Query

Post by Benjamin »

Code: Select all

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