Forum Moderators: coopster

Message Too Old, No Replies

Retreive first characters from a field

         

nicuz

5:59 am on Jun 30, 2006 (gmt 0)



I have a field in my database called "description" (type:longtext) and I would like to retreive the first let's say 13 characters. What wold the select query be?

dreamcatcher

6:05 am on Jun 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi nicuz,

You can use the MySQL string function SUBSTRING [dev.mysql.com].

Select SUBSTRING(description,0,13) as new_text FROM table...

Then use the 'new_text' variable to access the data.

dc