SQLite Forum

Help with a search command
Hi, I am using Lazarus on a Linux PC and SQLite3. I have a small home-use database for random data. Each Page has 1-Text Data Field and 10-Key Data Fields. 

With a lot of searching and reading I figured out the code below which works OK as I am only dealing with several hundred Records. 

Often I get many pages with the same Key in one Field or another and getting a lot of results to a search. I'd like to add in another Key Field with "AND" to be more specific on the returned Records. But, I cannot figure it out.

I wrote a routine to iterate through the entire Data File checking with "and" Fields, but it is slow compared to the native-SQLite search.

Could some kind soul please help out here.

The code...
    sqlStr:='SELECT * FROM sqlDiaryData '+
      ' WHERE ( fldKey0 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey1 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey2 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey3 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey4 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey5 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey6 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey7 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey8 LIKE '+QuotedStr(tStr1)+' ) '+
         ' OR ( fldKey9 LIKE '+QuotedStr(tStr1)+' ) '+
         ' ORDER BY '+fldKey0;