Mysql-how does Mysql add regular strings to a field in the table to write SQL statements? For example (1 P, 2 P, 3 P)

Source: Internet
Author: User
! Refer Image description ((img.ask.csdn.netupload201504071428383413_989153.jpg) Table B has three fields: aid, partname, and partid. I want the partid field to add regular strings based on the value of partname. For example, if the partname field is PART1, the partid field is added with a value of 1 P. if the partname field is PART2, the partid field is added with a value of 2 P. in addition to the preceding format, the partname values include TV01, TV02, special... string mysql



Table B has three fields: aid, partname, and partid. I want the partid field to add regular strings based on the value of the partname field.
For example, if the partname field value is PART 1, add 1 P to the partid field, and if the partname field value is PART 2, add 2 P to the partid field,
In addition to the preceding formats, the partname values include TV 01 and TV 02. the features are strings with (none) spaces and numbers,
There is also a number that is clipped in the middle of the string, 1st words, 2nd words, 11th words. The last simplest is a pure number, 1, 2, 3
The statement extracts the numbers in the three feature fields, and adds 1 P, 2 P, and 2 P to the partid field,
The value of 3 p.
How can I write SQL statements like this?

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.