SQLite question

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

dglass
Posts: 519
Joined: Thu Sep 24, 2009 9:10 pm
Contact:

Re: SQLite question

Post by dglass » Thu May 05, 2011 3:07 am

Peter K wrote:

Code: Select all

CASE mortgage_rates.int_only when '1' then cust_info.loan_amt * ((mortgage_rates.int_rate/1200)/((1-(1-mortgage_rates.int_rate/1200)*-360))) when '2' then (cust_info.loan_amt * mortgage_rates.int_rate/100)/12 END
the *-360 on the second line should be exponentiation (to the negative 360 power). I can't figure our how to do exponentiation in SQLite.

Thanks,

Peter
Ouch.

Vanilla SQLite has no power function, but if the powers were simple you could probably do it manually. Yours aren't so that's not really an option. :(

The only thing that comes immediately to mind is to return the numbers to do the math in your query results, and actually do the math in your interface before displaying the numbers (I'm assuming you are displaying them). Not ideal since the data and the interface become more tightly tied, but ... :|

Theoretically you could add an exponent function to SQLite, but that has gotchas of its own.

Post Reply