MySQL intercept string substring_index (Str,oat,index)

Source: Internet
Author: User

Category_search_name similar to the following
0-123: Clothing Shoes and hats 0-123-137-202: Clothing shoes and hats-0-speed food-0 instant noodlesfirst-with the second-(the number between the:) is the first-level category ID (123)Substring_index (Substring_index (Substring_index (Category_search_name, '-', 2), '-',-1), ': ', 1)Substring_index (Category_search_name, '-', 2) means interceptthe second of the Category_search_name string-thebeforeall the fieldssubstring_index (str, '-',-1)represents all fields after the first-after intercepting the STR stringsubstring_index (str, ': ', 1) indicates the first intercept of the STR string:beforeall the fieldsif no symbol is found, the original string is returned

MySQL intercept string substring_index (Str,oat,index)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.