I have an application who saves some files in an sql开发者_如何转开发 database. I'm using Full text search for filtering on the documents, now i wonder if it's possible to select the first lines of a document? So i can make a sort of "google" page for my application
Try this SQL. This will give you first 255 characters from the table which match the columnname againg query.
SELECT SUBSTR(`columnname`, 0, 255) AS blurb FROM `tablename` WHERE MATCH (`columnname`) AGAINST('query');
Then, you can disaply the blurb
as first few lines of the document.
精彩评论