开发者

return the first n letters of a column

开发者 https://www.devze.com 2023-02-10 17:01 出处:网络
I know that MySQL can choose queries with certain length. Can MySQL output only the first 开发者_StackOverflow社区10 letters from the word?

I know that MySQL can choose queries with certain length.

Can MySQL output only the first 开发者_StackOverflow社区10 letters from the word?

Form Example

mysql_query(SELECT LEFT(col,10),some2,some3 FROM someTable);

In the col I have for example

'TextForExampleLongerThanTen'
'Text' 
'SHORTER'
'LONGERAGAINTHANTEN'

I want these all to be output but, only their first 10 symbols


Use "LEFT()", e.g.

SELECT LEFT(col, 10) FROM table;
0

精彩评论

暂无评论...
验证码 换一张
取 消