MySQL Forums
Forum List  »  Optimizer & Parser

Desperate: BETWEEN and ORDER BY on different columns
Posted by: Joachim Berger
Date: September 01, 2011 02:35AM

Hi, is there any chance to perform a range scan and simultaneously order by another column?

In other words: What indexes do I need for performing a query like this, which uses the index and does no filesort? Is that possible?

SELECT id

FROM members

WHERE (sex = 2)
AND (birthdate BETWEEN '1980-09-01' AND '1984-09-01')

ORDER BY rnd

LIMIT 10;


Best,
Ben

Options: ReplyQuote


Subject
Views
Written By
Posted
Desperate: BETWEEN and ORDER BY on different columns
5726
September 01, 2011 02:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.