I have a table containing number eg: 289-5166
I want to query the DB and select only the number who's last four are 4833
Is there a way to write such a query/lookup in mysql ?
Thanks, BB
http://mysql.com/doc/refman/5.0/en/string-functions.html
SELECT SUBSTRING('PHONE #' FROM -4 FOR 4);
Let me see if I understand !
I would write my query like this: select name from Phones where substring('phone_number' FROM -4 FOR 4='4438'); OR .....
Thanks
I'm not a mysql expert to be honest, but try this:
SELECT `name` from Phones WHERE ( SUBSTRING(`phone_number` FROM -4 FOR 4)='4438' )