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

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -