I have a table with two columns, one column (AffiliationCountry) shows the countries and the other column (ArtSubareaKeyword) shows the subject areas in related countries with comma-separated values.
I want to extract the subject area which is repeating for a country the same country one or more times and save it in a new column with the name "MostPopularSubjectArea".
Table with values:
As you can see in the table that a country is repeating and its values are also repeating.
AffiliationCountry | ArtSubareaKeyword1 | ArtSubareaKeyword1 | ArtSubareaKeyword1 |
---|---|---|---|
Spain | Cell membranes | Cell staining | Coimmunoprecipitation |
Kazakhstan | Factor analysis | Human performance | Immunofluorescence |
Japan | Bone marrow | Diagnostic medicine | Genetic loci |
Kazakhstan | Drug research | Factor analysis | Human performance |
Results that are required:
I want a SQL query that can store for that country a new column that stores the common subjects area which is occurring more.
AffiliationCountry | MostPopularSubjectArea |
---|---|
Kazakhstan | Human performance |