MySQL handles field content separated by commas

Source: Internet
Author: User

There is a field that holds the checkbox content, such as a career target selection for database field otworkgoal, saving 1,2,3,4 content

Now you need to use the pure MySQL statement to translate the field otworkgoal content into Chinese.

Can be implemented using the Find_in_set () function +concat_ws () function.

Find_in_set () refer to Https://www.cnblogs.com/zxmceshi/p/5479892.html

Concat_ws () refer to http://blog.csdn.net/desilting/article/details/38563087

The specific SQL statements are as follows

SelectConcat_ws (',',(Select 'accumulate experience skills and resources for entrepreneurship'  fromOnline_person_info QwhereFind_in_set ('1', Q.otworkgoal) andT.id=q.id), (Select 'Higher position Promotion space'  fromOnline_person_info QwhereFind_in_set ('2', Q.otworkgoal) andT.id=q.id), (Select 'Better Remuneration Package'  fromOnline_person_info QwhereFind_in_set ('3', Q.otworkgoal) andT.id=q.id), (Select 'more challenging job content'  fromOnline_person_info QwhereFind_in_set ('4', Q.otworkgoal) andT.id=q.id), (Select 'Learn more about your professional skills'  fromOnline_person_info QwhereFind_in_set ('5', Q.otworkgoal) andT.id=q.id), (Select 'a more comfortable working environment'  fromOnline_person_info QwhereFind_in_set ('6', Q.otworkgoal) andT.id=q.id), (Select 'reduced working pressure'  fromOnline_person_info QwhereFind_in_set ('7', Q.otworkgoal) andT.id=q.id), (Select 'Closer to work distance'  fromOnline_person_info QwhereFind_in_set ('8', Q.otworkgoal) andT.id=q.id), (Select 'other'  fromOnline_person_info QwhereFind_in_set ('9', Q.otworkgoal) andT.id=q.id)) asOtworkgoal fromOnline_person_info TwhereT.id=' A'

can be translated

MySQL handles field content separated by commas

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.