Lets say I have a table with columns A , B , C , D and I want to do a match on column A and C
I see that you can either match a single column or all column in sqlite ie
- match column A
select * from table where A match 'cat'
- match all columns
select * from table where table match 'cat'
Is it possible to match only columns A and C? If not, how do you guys get around this?
Thanks for your suggestion!
For the multiple column condition using MATCH use UNION for the 'OR' and use INTERSECT for the 'AND'
Instead of specifying which columns to match to, you can specify the entire table to match to. For example:
You can concatenate columns using the || operator:
I'm not sure about the MATCH function in SQLite though, I think it will usually throw an exception (see http://www.sqlite.org/lang_expr.html#match).
I don't think you can use multiple MATCH operators in a single FTS query. Use column_name:target_term to search multiple columns using one full text search.
http://www.sqlite.org/fts3.html#termprefix
Using sub-queries as workaround:
OR
equivalent query, likea MATCH 'cat' OR c MATCH 'cat'
:AND
equivalent query, likea MATCH 'cat' AND c MATCH 'cat'
: