Database SELECT using two conditions???
I am trying to query a database and retrieve a row matching two conditions
Titanium Code: I have tried both of the following
var resultSet = db.execute('SELECT * FROM goals WHERE goal_type= "current" AND client_id = ?', id);
var resultSet = db.execute('SELECT * FROM goals WHERE goal_type= ? AND client_id = ?', 'current', id);
I get an error in the console: NOT FOUND
When I query the database in cmd prompt it returns 1 row:
SELECT * FROM goals WHERE goal_type = 'current' AND client_id = 7002;
Does anyone know where im going wrong here?
Trent
1 Answer
-
Are you sure you have more than one row that meets that condition? Each row that you want returned would have to have the goal_type='current' AND the client_id=7002 . Not OR.