sql - Not selecting duplicates rows -


my sql code below

select    country,    region,    count(country) [count],    case when  region null 0  else 1 end category     games group      grouping sets (                 (country, region)                  ,(country)                       )                having grouping(region) = 0 or count(distinct region) > 0  order     country,     category,     region  

result below

country         region    count  category -------         -------    ---    ------- unknown         unknown    3       0 unknown         unknown    3       1 austria         null       1       0 austria                  1       1 belgium         null       1       0 belgium                  1       1 czech republic  null       3       0 czech republic           1       1 czech republic  b          1       1 czech republic  c          1       1 opps            opps       1       0 opps            opps       1       1 turkey          null       6       0 turkey                   1       1 turkey          b          1       1 turkey          c          1       1 turkey          d          1       1 turkey          e          1       1 turkey          h          1       1 

i don't want select duplicate rows according example result below

unknown         unknown    3       0 opps            opps       1       0 

is possible?

this long comment.

if grouping on country , region, 'unknown'/'unknown' cannot duplicated. grouping sets conditions have nothing this. additional rows produce have null values in 1 or both of these columns.

so, conclusion 'unknown' different in different rows. may not see difference. 1 possibility trailing spaces. invisible characters.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -