MySQL Select Query - Get only first 10 characters of a value

前端 未结 3 1626
醉话见心
醉话见心 2020-11-29 00:44

Ok, so here is the issue.

I have a table with some columns and \'subject\' is one of the columns. I need to get the first 10 letters from the \'subject\' field no ma

相关标签:
3条回答
  • 2020-11-29 01:38

    Using the below line

    SELECT LEFT(subject , 10) FROM tbl 
    

    MySQL Doc.

    0 讨论(0)
  • 2020-11-29 01:40
    SELECT SUBSTRING(subject, 1, 10) FROM tbl
    
    0 讨论(0)
  • 2020-11-29 01:42

    Have a look at either Left or Substring if you need to chop it up even more.

    Google and the MySQL docs are a good place to start - you'll usually not get such a warm response if you've not even tried to help yourself before asking a question.

    0 讨论(0)
提交回复
热议问题