Jump to content

SQL


Guest nilesh k

Recommended Posts

Guest nilesh k

i want to show 35 words(not character) out of 100 or more words how can i do that?pls help any1

Link to comment
Share on other sites

What about this function (assuming you use mysql)? Use ' ' as the delimiter. You would probably need another function to count the number of words. Why don't you use php to do this - surely it's easier?SUBSTRING_INDEX(str,delim,count)Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2); -> 'www.mysql'mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2); -> 'mysql.com'This function is multi-byte safe.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...