Strange behavior when trying to compare field with 0 in where clause
Let's say I have 2 entries in my db:
-- Name -- approved -- resolved
-- Record1 -- 1 -- 0
-- Record2 -- 1 -- 1
I am fetching records with Where clause
$results = DB::table('mytable')->where('mytable.approved','=',1)->where('mytable.resolved','=',0);
The strange behavior is that it refuses to fetch the string Record1
if resolved=0
,
if i change the request to
$results = DB::table('mytable')->where('mytable.approved','=',1)->where('mytable.resolved','>',0);
He removes Record2
.
Anyone have an idea what happened?
I tried to play with the field type and make it boolean and null, didn't help.
+3
source to share