I make a request, but I need to display the text not all that is there, but only the first 4 rows or somehow by the number of words, tell me who knows how to implement it.

Select name, description from table Where id=8 
  • Well, do it not by means of scl - Gorets

2 answers 2

 SELECT TOP 4 name, description FROM table WHERE id=8 

selects the first 4 rows from the table that fit the specified conditions (WHERE id = 8)

  • Mysql has no TOP. - msi
  • and limit ??? - Modus

The easiest way to display the number of characters, for example, 100:

 substr(description, 1, 100) 

In order not to break the word, you can continue, for example, to the nearest space (or a point, etc.):

 substr(name,1,instr(substr(description,100),' ')+1)