RE: [sqlite] Re: Math functions

2007-04-05 Thread Nathan Biggs
That was exactly what I was looking for thanks!

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 04, 2007 6:41 PM
To: SQLite
Subject: [sqlite] Re: Math functions

Nathan Biggs [EMAIL PROTECTED] wrote:
 Does anyone know if there is a floor function in sqlite, or of a way
 to implement it.

cast(expr as integer) truncates towards zero, in case it helps.

Igor Tandetnik


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Re: Math functions

2007-04-05 Thread Igor Tandetnik

Brad Stiles [EMAIL PROTECTED] wrote:

On 4/4/07, Nathan Biggs
[EMAIL PROTECTED] wrote: 



Does anyone know if there is a floor function in sqlite, or of a way
to implement it.



Well, the suggestions about extending SQLite are probably quicker,
but if a SQL solution is required for portability, you can try
something like this:  


select case when @float = 0.0 then cast(@float as int) else
cast(@float-1 as int) end 


This would give wrong answer if @float is negative and whole.

Igor Tandetnik

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Re: Math functions

2007-04-04 Thread Igor Tandetnik

Nathan Biggs [EMAIL PROTECTED] wrote:

Does anyone know if there is a floor function in sqlite, or of a way
to implement it.


cast(expr as integer) truncates towards zero, in case it helps.

Igor Tandetnik

-
To unsubscribe, send email to [EMAIL PROTECTED]
-