Mysql: Find rows where column value ends with a specific substring

前端 未结 4 1250
情书的邮戳
情书的邮戳 2021-02-18 19:20

I have a column url where all the values are urls. I\'m trying to update the value of a different column where-ever the aforementioned url ends with .pdf

4条回答
  •  深忆病人
    2021-02-18 19:42

    So it looks like you are looking for the like parameter.

    for example:

    SELECT column(s) FROM table WHERE URL LIKE '%.pdf'
    

    Or you can update with

    UPDATE table SET column = value, ..., WHERE URL LIKE '%.pdf'
    

    The % is like saying anything before the .pdf is htis case.

    Hope this helps.

提交回复
热议问题