tags:

views:

63

answers:

3

Hello,

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.

A: 

Have a look at SUBSTRING

astander
And at REGEXP also :-)
Qwerty
+2  A: 

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.

Select0r
A: 

I think something like this will get

SELECT CONCAT(SUBSTRING( TITLE, 1 ,1),' ', TITLE) from TITLE

returns

 a|auto
 b|business
 s|Sports
Laykes