> SELECT * FROM t WHERE > (a >= a1 AND b>=b1 AND c>=c1) ORDER BY a,b,c LIMIT 1 OFFSET 1; > > using the way LIMIT cuts down on sort time (I've never tried it with both > LIMIT and OFFSET, though; you could always use LIMIT 2 and skip a record > client-side if that works better).
Don't want to further clutter the list (answered this question several times already), but your query does not work. What I meant to write was: select * from t where a >= a1 and (a > a1 or b >= b1) and (a > a1 or b > b1 or c > c1) order by a, b, c limit 1 The problem with your query is it excludes all values of c >= c1 regardless of values of a and b. Merlin ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings