I would like to select some data and开发者_如何学编程 put first letter of title field into another field. Is it possible?
auto
business
Sports
1st offer
I want to get something like that
a|auto
b|business
s|Sports
0|1st offer
0 = any non alphabetic character
Thank you.
try
UPDATE table SET field = LEFT(title, 1);
You may also want to use LOWER() to only get lowercase first letters. Use a condition to filter non-alphanumeric characters and assign "0" to field in that case.
Have a look at SUBSTRING
I think something like this will get
SELECT CONCAT(SUBSTRING( TITLE, 1 ,1),' ', TITLE) from TITLE
returns
a|auto
b|business
s|Sports
精彩评论