Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sqlite FTS, Using OR between match operators

Tags:

sqlite

match

fts3

When I execute the following query in a sqlite engine (android or sqlitebrowser) it throws an exception that says unable to use function MATCH in the requested context.

select
    a.Body1,
    b.Body2
from
    tbl1_fts  as a,
    tbl2_fts  as b
where
    a.ID = b.ParentID and

    (
        a.Body1 match('value') or
        b.Body2 match('value')
    )

-Both tables have fts.
-Using And operator between two matches (instead of OR) runs normally.

How can I fix this or change the query to find rows with above condition?

like image 867
Bagherani Avatar asked Oct 31 '22 21:10

Bagherani


1 Answers

you can not use OR Operation, just change your Match Keyword. like SELECT * FROM docs WHERE docs MATCH 'sqlite OR database';

OR maybe you can use union

SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database' UNION SELECT docid FROM docs WHERE docs MATCH 'library';

like image 163
Jimmy Chen Avatar answered Dec 20 '22 00:12

Jimmy Chen