I need to fetch value from table by matching string from right. Here is my table:
db_user:
id mobile
1 9937229858
2 9937229867
Here I have this value $mob=+919937229858 and I need to search from table. Here I need query to search from right if any column value i.e-9937229858 is matched with $mob=+919937229858 from right then that row will be fetched. Here as per value the first row value will be fetched.
You need to use a like and concatenate a wildcard on the column value. Something like:
select * from table where ? like concat('%', mobile)
I think will do it.
You have to put % and search whit LIKE
SELECT * FROM db_user WHERE mobile LIKE '%9937229858' ;