Scott Hess wrote:
> I think you're going to have to run some code to generate the string
> to match against.  The problem is that you need to take all of the
> 'query' fields from 'category' and combine them into a string like
> 'query1 OR query2 OR query3 OR ...'.  I'm not aware of a way to do
> this with straight SQL.  You could perhaps build an aggregate function
> which took strings and combined them, then it might be something like:
> 
>   SELECT guid FROM data WHERE text MATCH (SELECT string_join(query, '
> OR ') FROM category);
> 

This function already exists, and is included in SQLite. It is called 
group_concat(). See http://www.sqlite.org/lang_aggfunc.html for details.

   SELECT guid
   FROM data
   WHERE text MATCH
     (SELECT group_concat(query, ' OR ') FROM category);

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to