lundi 13 juillet 2015

Mapping string fragments from two SQL columns based on the position of the fragments (using a delimiter, say ";", to discern position)

I have two columns that I'd like to map - Name and Test (this is a mockup):

Entry_ID: 1
Type: HIV
Name: John;Maria;Michael;Thomas;Jenna;Anna
Tested: Yes;No;No;Unneeded;Yes;Yes

Entry_ID: 2
Type: HPV
Name: Jenna;Peter;Michael;Nick;Richard
Tested: No;No;No;Yes;Unneeded

Entry_ID: 3
Type: HCV
Name: Maria;John;Nick;Richard;Thomas;Jenna;Anna;Peter
Tested: Yes;Yes;Unneeded;Yes;Yes;No;No;No

Is it possible to create a query that will output only entries with specific pairs? For example only entries with Maria-Yes, which would produce:

Entry_ID: 3
Type: HCV
Name: Maria;John;Nick;Richard;Thomas;Jenna;Anna;Peter
Tested: Yes;Yes;Unneeded;Yes;Yes;No;No;No

as a result, or Thomas-No, which would result in an empty set.

Aucun commentaire:

Enregistrer un commentaire