On 3/6/2013 10:20 AM, Yuzem wrote:
I want to get a specifed number of movies by genre, for example 3 movies by
genres:
Action|[movie id]
Action|[movie id]
Action|[movie id]
Adventure|[movie id]
Adventure|[movie id]
Adventure|[movie id]
Animation|[movie id]
Animation|[movie id]
Animation|[movie id]
etc...

select genres, movies from genres g1 where movies in
(select g2.movies from genres g2 where g1.genres = g2.genres order by g2.movies limit 3)
order by genres;

--
Igor Tandetnik

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

Reply via email to