Martin Jenkins-2 wrote:
>
> fangles wrote:
>> I'm currently searching through all columns in a table to see if any
>> match
>> the search text and the query is rather cumbersome. Is there a way to use
>> a
>> loop to go through all available columns by some means? Maybe a loop by
>> querying the schema?
>>
>> SELECT * FROM addresses WHERE title LIKE '% + searchtext + %'
>> OR first LIKE '% + searchtext + "%'
>> OR middle LIKE '% + searchtext + "%'
>> OR last LIKE '% + searchtext + "%'
>> OR street LIKE '% + searchtext + "%'
>> OR suburb LIKE '% + searchtext + "%'
>> OR city LIKE '% + searchtext + "%'
>> OR postcode LIKE '% + searchtext + "%'
>> OR state LIKE '% + searchtext + "%'
>> OR country LIKE '% + searchtext + "%'
>> OR work LIKE '% + searchtext + "%'
>> OR home LIKE '% + searchtext + "%'
>> OR mobile LIKE '% + searchtext + "%'
>> OR company LIKE '% + searchtext + "%'
>> OR misc1 LIKE '% + searchtext + "%'
>> OR misc2 LIKE '% + searchtext + "%'
>> OR email LIKE '% + searchtext + "%'
>> OR note LIKE '% + searchtext + "%'
>> OR category LIKE '% + searchtext + "%'
>> OR displayas LIKE '% + searchtext + "%'
>> OR firstentry LIKE '% + searchtext + "%'
>> OR lastedit LIKE '% + searchtext + "%'
>> OR deleted LIKE '% + searchtext + "%' ORDER BY displayas
>>
>> This is a big one!!
>
> Could you not join all the columns and search that?
>
> select * from addresses where first||middle...deleted like searchtext;
>
> Martin
>
>
Probably because I didn't know about it. Hmm, so much to learn, so little
brain
--
View this message in context:
http://www.nabble.com/Search-all-collumns-with-LIKE-at-once-tf3251161.html#a9039025
Sent from the SQLite mailing list archive at Nabble.com.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------