G
Guest
I have three tables. contact, place, firm. contact has PK idContact and FK
idPlace and idFirm. I want to make a query to find number of firms having
contact with each place. In contakt there are several tuples wich shows that
the same firm has several contacts with the same place.
table contact
idContact idPlace idFirm
1 5 4
2 5 4
3 6 5
4 7 9
When I select I want the result to be
Place Number of firms having contact
5 1
6 1
7 1
idFirm is PK in table firm
idPlace is PK in table place
Of course I will display name of place in stead of idPlace shown here.
The problem is how to count idFirm= 4 as 1 instance at idPlace 5
Anyone who has a solution for this query?
idPlace and idFirm. I want to make a query to find number of firms having
contact with each place. In contakt there are several tuples wich shows that
the same firm has several contacts with the same place.
table contact
idContact idPlace idFirm
1 5 4
2 5 4
3 6 5
4 7 9
When I select I want the result to be
Place Number of firms having contact
5 1
6 1
7 1
idFirm is PK in table firm
idPlace is PK in table place
Of course I will display name of place in stead of idPlace shown here.
The problem is how to count idFirm= 4 as 1 instance at idPlace 5
Anyone who has a solution for this query?