troubleshooting Question

Retrieving Results based on distinct and grouped

Avatar of kenuk110
kenuk110 asked on
Microsoft SQL Server 2008
2 Comments1 Solution203 ViewsLast Modified:

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.



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

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros