Good catch! I will check if I have similar errors, but printf() returns TEXT, round() returns FLOAT. So, do your numerical comparisons BEFORE formatting statements.
On Mon, Sep 16, 2019 at 2:45 AM Hick Gunter <h...@scigames.at> wrote: > This is well documented in https://sqlite.org/datatypes.html and > https://sqlite.org/datatype3.html > > > -----Ursprüngliche Nachricht----- > Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > Im Auftrag von kapil > Gesendet: Samstag, 14. September 2019 11:15 > An: sqlite-users@mailinglists.sqlite.org > Betreff: [EXTERNAL] [sqlite] Comparison of incompatible types > > Hi all, > > I was wondering whether sqlite does type checking for fields which are > referenced in WHERE clause. Because when i tried to compare a field > generated by printf function and tried to compare it with a float value, > the comparison didn't work > > Eg. > SELECT count.theme as theme, printf("%.2f", > (count.num_sets*100.00/sum.total)) as percentage > > FROM count,sum > > WHERE percentage >= 5.00; > > It was not giving expected results. > When i replaced printf with ROUND function, it worked. > So i got to think whether this was because printf returns string value. > > If so then shouldn't there be type check on fields in comparisons so that > user can get a meaningful error message or in this case, any error message > at all > > Regards > Kapil Garg > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > > ___________________________________________ > Gunter Hick | Software Engineer | Scientific Games International GmbH | > Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) > +43 1 80100 - 0 > > May be privileged. May be confidential. Please delete if not the addressee. > _______________________________________________ > 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