Count if or Count where in SQL

Viewed 150

I have a data set of contracts and the nationalities of people working on them. A sample is as follows.

Contract  Country
GTT001    DE
GTT001    DE
GTT001    US
BFF333    US
BFF333    US
BFF333    DE
HHH222    GB
HHH222    GB
HHH222    GB

I need a query that will count the number of people working on each contract from each country. So one that will produce a table like below:

         DE   US    GB
GTT001   2    1     0
BFF333   1    2     0
HHH222   0    0     3

I am working in Access 2010. Is there a countif or some equivalent that will allow me to count values based on conditions?

3 Answers
Related