MySQL: display only 200 characters of the total value.

I have a MySQL table with a field with a name descriptionwith this entry:

Former cop Brian O'Conner talks to the former Toretto House on the opposite side of the law. As Brian and Mia Toretto broke the Detention House, they crossed many borders to elude the authorities. Now, once in a corner in Rio de Janeiro, they must take their last job to get freedom. When they assemble their elite team of top racers, unlikely allies know that their only chance is to get out on good money to confront a corrupt businessman who wants them to be dead. But he is not the only one on his tail. Tough nasal federal agent Luke Hobbs never misses his target. When he is assigned to track House and Brian, he and his attack team launch a total attack to capture them. But as his people rush through Brazil, Hobbs finds outthat he cannot separate the good guys from the bad ones.

How can I display the first 200 characters? Like this:

Former police officer Brian O'Conner collaborates with former head of House Toretto on the opposite side of the law. As Brian and Mia Toretto broke the Detention House, they crossed many borders to elude the authorities.

+5
source share
5 answers
SELECT LEFT(description, 200)
FROM yourtable

relevant documents here .

+9
source

Try the following:

SELECT SUBSTR(description, 1, 200) 
FROM your_table

Here you can find docs

+6
source

SELECT * FROM table ...

PHP :

echo substr($desc, 0, 200); //1st 200 characters

DOC

+2
SELECT SUBSTRING(`description`,1,200) as description FROM table

1 200 "", mysql_fetch_assoc()

+2

, PHP, :

SELECT SUBSTRING(description, 0, 200) FROM TABLE_NAME
-1

All Articles