• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Retrieving Results based on distinct and grouped

Hi,

I have a table with data that is broken down as follows:

countryCode, cityCode, storeCode, storeType, gridCodeX

I need to get a result, distinct, from this table so it totals up how many distinct gridCodeX's there are in a store within a city within a country

I have tried the following in around 100 itterations but to no avail!

Any help would be much appreciated.

Regards,

Ken




select distinct countrycode,citycode,storecode,count(gridcodex) from block 
group by countrycode,citycode,storecode, gridCodeX

Open in new window

0
kenuk110
Asked:
kenuk110
1 Solution
 
EyalCommented:
select countrycode,citycode,storecode,count( distinct  gridcodex) from block
group by countrycode,citycode,storecode, gridCodeX
0
 
kenuk110Author Commented:
Perfect, looks so simple when you see the answer yet seems impossible when you don't.

Really appreciate you help.

0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now