Ok, wonderful, now it is working correctly but how do I select multiple columns from table movies? Should I add another sub query? Example:
SELECT genres.genres, ( SELECT substr(group_concat(name,' '),1,60) FROM ( SELECT name FROM movies JOIN genres AS movie_genres ON movies.movies = movie_genres.movies WHERE movie_genres.genres = genres.genres ORDER BY movies.name LIMIT 6 ) ), ( SELECT substr(group_concat(movies,' '),1,60) FROM ( SELECT name FROM movies JOIN genres AS movie_genres ON movies.movies = movie_genres.movies WHERE movie_genres.genres = genres.genres ORDER BY movies.name LIMIT 6 ) ) FROM genres GROUP BY genres ORDER BY genres.genres; If I add another sub query it takes almost twice the time than using only one sub query. It is still faster than before. Petite Abeille-2 wrote > Yeah… the inner join vs out join will produce a significantly different > access plan. Yes but if that's the case don't you think that the difference in time is a bit much? And why there is almost no difference between JOIN and LEFT JOIN when using tasks and people which are larger tables? -- View this message in context: http://sqlite.1065341.n5.nabble.com/Please-help-me-optimize-this-LEFT-JOIN-query-tp71000p71038.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users