PostgreSQL likewise returns 0 for 2/4 and .5 for 2/4.0 . This is likely a
part of the SQL standard.


On Wed, Apr 30, 2014 at 7:11 AM, Marc L. Allen
<mlal...@outsitenetworks.com>wrote:

> Not an error. Int/Int uses integer division and results in an integer
> number. When one number is a float, the result becomes a float.
>
> I don't know about all SQL varieties, but MSSQL is the same.
>
> > On Apr 30, 2014, at 8:04 AM, "Gene Connor" <neothreeei...@hotmail.com>
> wrote:
> >
> >
> > SELECT DISTINCT 2/4 AS RESULT FROM TABLE;returns 0
> > SELECT DISTINCT 2/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4.0 AS RESULT FROM TABLE;returns 0.5 (correct)
> > SELECT DISTINCT 2.0/4.01 AS RESULT FROM TABLE;returns 0.49875 (correct)
> > As long as one or both numbers has at least one decimal place, it calcs
> correctly.
> > Verified that it also happens in queries using tables and real data.
> > Windows SQLite version 3.8.4.3 2014-04-03 16:53:12
> >
> > Thanks
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> This email and any attachments are only for use by the intended
> recipient(s) and may contain legally privileged, confidential, proprietary
> or otherwise private information. Any unauthorized use, reproduction,
> dissemination, distribution or other disclosure of the contents of this
> e-mail or its attachments is strictly prohibited. If you have received this
> email in error, please notify the sender immediately and delete the
> original.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to