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'
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
Post a Comment