sql - Count of distinct groups that have a value of > 0 in any of its records for a given column -


the 2 columns:

a) company name. there can multiple records company: 1 record per company per month.

b) sales. given company given month, sales value 0 or greater.

what want query return:

a count of distinct companies had sales of > 0 one or more months

thanks in advance help!

something similar to:

select count(distinct companyid) salestable sales > 0 

simply count number of distinct companyid's have sales > 0.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -