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
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------