Suppose User typed 'test' in search text box, I would like to search the
'test' string in all the coulmns ... I do not want exact match.. The
columns could contain strings like 'tester'  or 'tested' . I should be
able to get these records as well..

Hope I am clear explaining what I want..

-Thanks

 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of BareFeet
Sent: Friday, February 15, 2008 4:38 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQLite Like Query Optimization

Hi Kalyani,

> select ID from TableA where column2 like '%test%'  or column4like 
> '%test%' or column5 like '%test%' or column6 like '%test%' or column7 
> like '%test%'  or column8 like '%test%' order by column3 desc;

As already stated, the like operator can't use indexes if you use "or",
or start with a wild card.

Is each '%test%' in your example meant to be the same string, or
different strings? If different, then what exactly is each column
storing, and what are you trying to search for? Perhaps you could make
each column more "atomic" by splitting the contents into more columns,
which you could then search using "=" instead of "like" and so use
indexes.

Tom
BareFeet

  --
One stop Australian on-line shop for Macs and accessories
http://www.tandb.com.au/forsale/?ml

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to