You could create a field in the table Value01LessThanValue02 and use a
trigger to update this value whenever data is updated.  Then you can search
on just this one field.  However, it's a boolean result so depending on the
percentage of records that match this condition, the index may not be that
helpful in the end anyways.

HTH,

Sam
 
-------------------------------------------
We're Hiring! Seeking a passionate developer to join our team building Flex
based products. Position is in the Washington D.C. metro area. If interested
contact [EMAIL PROTECTED]
 
-----Original Message-----
From: Clodo [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 20, 2007 5:36 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] suggestion for an optimized sql

Hi, i have a table like this with thousand of records:

CREATE TABLE Table01 (
  id       integer,
  value01  text,
  value02  text
);

I need to optimize the following sql:

SELECT * FROM Table01 WHERE VALUE01<VALUE02.

How i can use indexes to avoid a full-table scan? Thanks!


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


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

Reply via email to