[Solar-talk] multiple SQL predicates

Cruz, Darwin Darwin.Cruz at gd-ais.com
Thu Dec 6 11:06:17 CST 2007


I'm trying to query the database using a SQL query with multiple
predicate clauses and i'm trying to figure out the best way to do that:

select * from customer where first_name = 'jim' and  last_name = 'smith'
and zipcode between 07710 and 07734; 

I've tried quilding an array to pass to the fetchAll() method but i'm
not getting anything:

		$options =  array(
			'where'	=> array(
				'first_name = jim',
				'last_name = smith',
				'zipcode between 07710 and 07734',
				
			),
			
		);

		$result = $myModel->fetchAll($options);


I've also tried building a Pdo statement as well with no luck:



		$pdoStatement = $sql->query('select * from customer
where first_name = 'jim' and  last_name = 'smith' and zipcode between
07710 and 07734');
		$result = $myModel->fetchPdo($pdoStatement);



More information about the Solar-talk mailing list