MySQL Forums
Forum List  »  Data Warehouse

Re: Best Match from the left
Posted by: Rick James
Date: May 17, 2011 11:40PM

Why this forum?

You want 5645343425, correct?

Here are the two candidates, one is the best:
SELECT num FROM tbl WHERE num < '56488888888' ORDER BY num DESC LIMIT 1
UNION ALL
SELECT num FROM tbl WHERE num >= '56488888888' ORDER BY num ASC LIMIT 1

Options: ReplyQuote


Subject
Views
Written By
Posted
5550
May 16, 2011 03:26AM
Re: Best Match from the left
2204
May 17, 2011 11:40PM


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.