> On Nov 29, 2018, at 7:45 AM, Maurice van der Stee <s...@planet.nl> wrote:
> 
> This reproduces the issue for me:
> 
> create table config (config_package integer, config_flags integer);
> insert into config (config_package, config_flags) values (1, 2);
> insert into config (config_package, config_flags) values (2, 4);
> insert into config (config_package, config_flags) values (3, 6);
> select config_package, config_flags, (config_flags & '4') from config
> where (config_flags & '4') != '4';
> 
> This produces:
> 
> 1|2|0
> 2|4|4
> 3|6|4

You’re putting single-quotes around the 4, so it is a one character string, not 
a number.

In the case of “ config_flags & ‘4’ ”, the “&” operator only accepts numbers, 
so the string is converted to a number.

In the case of “ <number> != ‘4’ “, the equality operator is checking to see if 
the number 4 is equal to the string ‘4’.  They are not.  != already returns 
true.

You can fix this by changing all instances of “ ‘4’ “ to just “4”.

  -j



> While it should only have returned the first row.
> -- 
> ===============================
> Maurice van der Stee (s...@planet.nl)
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to