Advertisement
Guest User

Untitled

a guest
Jun 19th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.37 KB | None | 0 0
  1. SELECT *
  2.     FROM mobilenum
  3.     WHERE
  4.         CAST(SUBSTRING(mobileno FROM -4) AS UNSIGNED) >= 1234
  5.         OR
  6.         CAST(SUBSTRING(mobileno FROM -4) AS UNSIGNED) < 1234
  7.     ORDER BY ABS(search - CAST(SUBSTRING(mobileno FROM -4) AS UNSIGNED)
  8.  
  9. -- replace the 1234 with the last 4 digits of your search number, $search
  10. -- ref: http://stackoverflow.com/questions/30932651
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement