Any way to select from MySQL table where a field ends in certain character/number?

后端 未结 7 508
南方客
南方客 2020-12-21 10:57

I am hoping to run a mysql_query where I can select a row if a certain field ends in a number. For example:



        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-21 11:41

    You can use regular expressions if you need to find if field is ending in a number or not as follows

    SELECT id FROM table WHERE id REGEXP '[0-9]$'
    

    Hope it helps...

提交回复
热议问题