Yuzem <[email protected]> wrote:
> Suppose I have this tables:
> movies: movie,name,rating
> tags: movie,tag
> filters: filter,expression
> 
> In filters I have:
> rated,rating != ''
> tagged,movie in (select movie from tags)
>
> But from the "filters" table (doesn't work):
> SELECT filter,movie FROM filters LEFT JOIN movies WHERE movie IN (SELECT
> movie FROM movie WHERE expression);

SQLite doesn't have anything like eval(). It can't take a string from a column, 
then parse and interpret it as part of a SQL statement.

You could probably write a custom function that would take (movie, expression) 
as parameters, build a statement of the form

select 1 from movies where movie=:movie and <expression>;

where <expression> is replaced with the actual expression (e.g. using sprintf), 
run this statement and return 1 if the statement produces any rows and 0 
otherwise. Then you could write

SELECT filter, movie FROM filters LEFT JOIN movies WHERE checkMovie(movie, 
expression);

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to