1

Here is an example of my table structure:

Key - Country - Store
1 - Germany- YYY
1 - Germany- YYY
2 - France- XXX
2 - France- XXX
2 - France- XXX
3 - United Kingdom- YYY 
3 - United Kingdom- YYY
4 - Germany- YYY
5 - France- YYY
5 - France- YYY

I would like to start a query on this table to get the following result:

Country- XXX - YYY
Germany - 0 - 2
France - 1 - 1
United Kingdom - 0 - 1

The problem for me ist the ID/Key which does not get used once but several times, thats why I cant just use a count query.

What should my query look like?

4

1 回答 1

0

You should be able to use the TRANSFORM function to get this result:

TRANSFORM Count(store)
SELECT Country
FROM 
(
  select distinct key, country, store
  from yourtable
) d
GROUP BY Country
PIVOT Store
于 2013-05-28T11:11:18.397 回答