Sunday 15 February 2015

phpmyadmin - mysql query to get just the 1st sentence in a paragraph -


I'm trying to copy just one sentence in a product description paragraph for a meta-detail tag Mysql For example the database. In this product description, I need 1 sentence to copy from product_description field to products_meta_description field. "Kendall Howard 8 U Compact Series SOHO server cabinet rack is ideal for IT setup with limited space. I sleek, durable design is specially designed for small businesses, home offices or IT professionals who Want to compact design without protecting your server rack devices. "

should be copied as products_meta_description:" Kendall Howard 8 U Compact Series SOHO Hwar cabinet rack setup for the limited space of IT. "

  Update products SET products_meta_description = Products_description (1 sentence only)   

Not sure how to do this I'm assuming that found in the paragraph First period (.) And everything will be available before that. BTW, I'm doing it in phpmyadmin sql query tool. There are thousands of products, so I thought it would be the easiest way to manually get the canned meta description tags entered for each product manually.

The MySQL function is ideal for:

  SET products_meta_description = SUBSTRING_INDEX (products_description, '.', 1)   

He will give you everything that comes before the first period . If you want the duration also, it is the easiest to get the result from CONCAT :

  Update products SET products_meta_description = CONCAT (SUBSTRING_INDEX (products_description, . ', 1),'. ')    

No comments:

Post a Comment