symbulos wrote:
how do you extract with a query only the first few lines from a blob field?

For instance: you have an article stored in the field. You would like to visualise the first few lines before reading it all.

You could use the LEFT() function to return for instance the 200 first characters:


SELECT LEFT(article,200) AS start_of_article
  FROM articletable WHERE ...

You could also use the SUBSTRING_INDEX() function, if your lines are separated with \r\n:

SELECT SUBSTRING_INDEX(article,'\r\n',2) AS two_first_lines
  FROM articletable WHERE ...

<URL: http://dev.mysql.com/doc/mysql/en/string-functions.html >

--
Roger


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to