> 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

The extra cast is there because in my tests, the cast *always* truncates 
towards 0, for both positive and negative numbers.  If you never have to deal 
with negatives, you can get away with the simple cast.

Brad 


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

Reply via email to