Re: [sqlite] Re: number problem with 3.2.8

2006-10-25 Thread Derrell . Lipman
"Lloyd Thomas" <[EMAIL PROTECTED]> writes:

> I did try number literal  >10 but mad no difference. I will rebuild the
> database row as an integer.

As an interim solution (prior to changing your database schema), you should be
able to use your existing schema with this query:

  select ring_time from calls where (ring_time + 0) > 10;

That should force the left side to be evaluated as an integer, and the right
side already is an integer.  You should get an integer comparison.

Note that if ring_time was indexed, your index will be ignored since you're
using a calculated value instead of the field.  Changing the schema is
certainly the proper solution if the value is supposed to be interpreted as an
integer.

Derrell

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



RE: [sqlite] Re: number problem with 3.2.8

2006-10-25 Thread Griggs, Donald

-Original Message-
From: Lloyd Thomas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 25, 2006 7:49 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Re: number problem with 3.2.8

I did try number literal  >10 but mad no difference. I will rebuild the
database row as an integer.
Lloyd


---

Or, if you have some reason for preferring varchar, you can choose to
force a numeric comparison at query time by adding "+0" as in:
   select  ring_time from calls where ring_time+0 > 10;

 

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



Re: [sqlite] Re: number problem with 3.2.8

2006-10-25 Thread Lloyd Thomas
I did try number literal  >10 but mad no difference. I will rebuild the 
database row as an integer.

Lloyd
- Original Message - 
From: "Igor Tandetnik" <[EMAIL PROTECTED]>

To: "SQLite" <sqlite-users@sqlite.org>
Sent: Thursday, October 26, 2006 12:21 AM
Subject: [sqlite] Re: number problem with 3.2.8



Lloyd Thomas
 wrote:

I am using sqlite 3.2.8 which is included in PHP5.1. I seem to be
having a problem doing queries where with '>' to search a number.
for instance if I do the following

select  ring_time fron calls where ring_time > '10';
I get the following results
3
6
3
6
3
6
2
3
3
3
2
etc.
Why?
This row is varchar. Is 3.2.8 not able to work with numbers stored as
varchar?


I don't see any problem. '3' is indeed greater than '10' in alphabetic 
order. What did you expect?


If you want the values to compare as numbers, why do you store them in a 
string field, and why do you compare against a string literal '10' rather 
than numeric literal 10 ?


Igor Tandetnik

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




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



[sqlite] Re: number problem with 3.2.8

2006-10-25 Thread Igor Tandetnik

Lloyd Thomas
 wrote:

I am using sqlite 3.2.8 which is included in PHP5.1. I seem to be
having a problem doing queries where with '>' to search a number.
for instance if I do the following

select  ring_time fron calls where ring_time > '10';
I get the following results
3
6
3
6
3
6
2
3
3
3
2
etc.
Why?
This row is varchar. Is 3.2.8 not able to work with numbers stored as
varchar?


I don't see any problem. '3' is indeed greater than '10' in alphabetic 
order. What did you expect?


If you want the values to compare as numbers, why do you store them in a 
string field, and why do you compare against a string literal '10' 
rather than numeric literal 10 ?


Igor Tandetnik 



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