On 11 Oct 2016, at 11:52am, Tobias Ellinghaus <m...@houz.org> wrote:
> Now I only want the first three values, 6, 5 and 7. However: > > sqlite> SELECT id FROM i WHERE id IN (SELECT id FROM m) ORDER BY flags DESC > LIMIT 0, 3; > 1 > 2 > 3 Your problem is that although SQL accepts the clauses written in the order you wrote them in, the LIMIT clause is processed before the ORDER BY clause. sqlite> SELECT id FROM i WHERE id IN (SELECT id FROM m) LIMIT 0, 3; 1 2 3 sqlite> Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users