mysql - Get data from table by County in a single row -


i want data table in single row single county. right shown in images shows different rows single county kalamazoo. should show single both records in single row.

i using following query

select county, virus, sumofpositivetests  statewisedata  state = 'michigan' 

enter image description here

i want results shown following

county        virus        sumofpositivetests --------------------------------------------- kalamazoo     h3n2,h3n8      3 

total sum of both h3n2 , h3n8

use mysql group_concat

the following mysql statement return list of comma(,) separated 'virus's each group of 'county' statewisedata table

select county,group_concat(virus),sum(sumofpositivetests) statewisedata  state='michigan' group county 

Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

angular - Angular2 Router: Cannot find primary outlet to load 'HomeComponent' -

qt - Microsoft FTP Service 451 The parameter is incorrect -