How does mysql-MySQL design and query the value of a result? different information of another table can be found under different circumstances.

Source: Internet
Author: User
The specific problem is described as follows: for example, the following data is available: data 1mutid medication information cosm1acsm2bcosm3ccosm4d data 2mutid medication information COSM1 + COSM2e logic is: if this person has three variations: COSM1COSM3COSM4, then the information about the variant medication is obtained. if this person has three variations: COSM1COSM2COSM4, how can the table such as COSM1 and COSM2eCOSM4d be designed and implemented. .. mysql design data

The specific problem is described as follows:
For example, the following data is available:
Data 1
Mutid medication information
COSM1
COSM2 B
COSM3 c
COSM4 d

Data 2
Mutid medication information
COSM1 + COSM2 e

The logic is: if this person has three variations: COSM1 COSM3 COSM4, what we get is
Variant medication information
COSM1
COSM3 c
COSM4 d

If this person has three variations: COSM1 COSM2 COSM4, what we get is:

Variant medication information
COSM1 + COSM2 e

COSM4 d

How should such a table be designed and queried?

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.