mysql left() right() 字符串截取

RIGHT(str,len)

从字符串str 开始,返回最右len 字符。

SELECT RIGHT('foobarbar', 4);

结果:

‘rbar’

PS:这个函数支持多字节字元。 

 

LEFT(str,len)

返回从字符串str 开始的len 最左字符。

SELECT LEFT('foobarbar', 5);

结果:

‘fooba’

 

 

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s