dongyu9263 2019-02-07 02:38
浏览 70
已采纳

MySQL最后一个字符串的子句

i have a some data code like this :

  1. PR 00001J
  2. PR 00001B
  3. PR 00002B
  4. PR 00002J
  5. PR 00003J

how i can get data only J with where clause ? is it need something like regex ?

i've been try with this query but the output was NULL

SELECT MAX(request_code) as max_request_code FROM `request` WHERE RIGHT('request_code',1) = 'J'

anyone can help me out ?

Thank you

  • 写回答

1条回答 默认 最新

  • dongwei7913 2019-02-07 03:03
    关注

    You can have it like this

    WHERE request_code LIKE '%J'
    

    You can refer to this link http://www.mysqltutorial.org/mysql-like/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?