views:

12

answers:

1

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

A: 

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.

shamittomar