Another where & and question
Another where & and question
Rappi
Posts: 82Questions: 18Answers: 1
Hi.
I need the following sql select:
SELECT * FROM tm_tiere WHERE Geloescht=0 AND Schutzgebuehr=0 AND (Adoptant!=0 OR Vermitteltdatum!=0000-00-00
When I use
->where( function ( $q ) {
$q ->where( 'tm_tiere.Schutzgebuehr', '0', '=');
$q ->where( 'tm_tiere.Geloescht',' 0', '=');
$q ->where( 'tm_tiere.Adoptant', '0', '!=' );
$q ->or_where( 'tm_tiere.Vermitteltdatum', '0000-00-00', '!=');
} )
The OR select is working but the Schutzgebuehr=0 don't work.
With
->where( function ( $q ) {
$q ->where( 'tm_tiere.Schutzgebuehr', '0', '=');
$q ->where( 'tm_tiere.Geloescht',' 0', '=');
//$q ->where( 'tm_tiere.Adoptant', '0', '!=' );
//$q ->or_where( 'tm_tiere.Vermitteltdatum', '0000-00-00', '!=');
} )
it shows me the entrys with Schutzgebuehr=0 AND Geloescht=0
How can I make my needed select?
Regards
Rappt
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Rappt,
You've already got one closure - you need another (in the context of the
where
condition a closure basically equates to being brackets):Allan
Great!
Thanks Allan.