Thanks Petite Abeille, I translated your code to this: SELECT genres.genres, ( SELECT substr(group_concat(name,' '),1,60) FROM ( SELECT name FROM movies
JOIN genres ON movies.movies = genres.movies ORDER BY movies.name LIMIT 6 ) ) AS sample FROM genres GROUP BY genres ORDER BY genres.genres; time: 0.028s It is incredibly fast but it gives me the wrong result: Action|American Graffiti American Graffiti American Graffiti Mulhol Adventure|American Graffiti American Graffiti American Graffiti Mulhol Animation|American Graffiti American Graffiti American Graffiti Mulhol Biography|American Graffiti American Graffiti American Graffiti Mulhol Etc... Am I doing something wrong? -- View this message in context: http://sqlite.1065341.n5.nabble.com/Please-help-me-optimize-this-LEFT-JOIN-query-tp71000p71035.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