Subject | Re: [firebird-support] Problem with a division |
---|---|
Author | Martijn Tonies |
Post date | 2009-09-16T08:43:08Z |
Hello Werner,
Try:
(oldprice/100.0000)
(or 100.00)
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com
>I can't figure out why I get a different result on division with FB then/100 results in an integer.
> e.g. doing it in Python.
>
> My sql:
> select newprice, oldprice, (newprice-oldprice)/(oldprice/100) as perc,
Try:
(oldprice/100.0000)
(or 100.00)
> extract(year from created) as statsyear, extract(month from created) asWith regards,
> statsmonth from pricechange;
>
> Result:
> NEWPRICE OLDPRICE PERC STATSYEAR STATSMONTH
> 25 21,3 17,619 2009 9
>
> In Python I get:
> >>> (25.00-21.30)/(21.30/100)
> 17.37089201877934
>
> What am I missing? I am pretty sure I am doing a stupid mistake:)
>
> Werner
>
> P.S. both newprice and oldprice are numeric(18, 2) columns
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com