tags:

views:

84

answers:

1

Please help me fetching google like url descriptions in just one SQL query.

see example

If description is greater than a fixed limit of characters say 100 characters then append '...' otherwise show the complete description.

My current SQL query is this:

 SELECT post_id, CONCAT( LEFT( post_text, 50 ) , '...' ) AS text FROM posts

Please suggest a solution...

A: 
if( length( post_text ) > 50, CONCAT( LEFT( post_text, 47 ) , '...' ), post_text )
palindrom