I have a table with antiviral activities for compounds in different cell lines infected with different viruses, like this:
ID  Batch_ID    Cell_Line   Virus   Conc    Effect
1   abc123      U87         ZIKV    5       67
2   abc123      SW13        HAZV    10      35
3   def456      U87         ZIKV    5       85
4   def456      SW13        HAZV    10      15
I would like to convert this to a View that looks like this:
ID  Batch_ID    U87_ZIKV_5  SW13_HAZV_10
1   abc123      67          35
2   def456      85          15
So basically a pivot that generates new columns and corresponding names by dynamically concatenating the original row values for Cell_Line, Virus and Conc, and then report the Effect for each compound. For a limited number of combinations this could of course be 'hard-coded' but I want to allow for the possibility of additional cell lines, virus strains and concentrations to be added later on, and hence for the pivoted column names to be generated dynamically.
Grateful for any pointers on how to code this efficiently in mySQL!
 
    