Our environmental nonprofit has several projects, and most projects have either a marine or terrestrial conservation area. Some have neither, and have therefore been marked as "no conservation area."
Some projects also have multiple conservation areas, and they might be of the same type. So I have a table like the following:
Project ID: Conservation Category:
1 Marine
1 Marine
1 Terrestrial
2 Neither
3 Terrestrial
3 Terrestrial
4 Marine
Sorry if that's hard to read - the first column is supposed to be numerical project ID's and the second shows which type of conservation category it has.
So I need to make a query that'll give me the number of projects with Marine, Terrestrial, Both, or Neither conservation categories. But I have no idea how to approach this, since I don't know how to get a query to recognize the "Both" condition.
The query should give the following result for the example above:
Conservation Category: Count:
Marine 2
Terrestrial 2
Both 1
Neither 1
Explanation: Project 1 and 4 have marine components. Projects 1 and 3 have terrestrial components. Only project 1 has both a marine and terrestrial component. Only project 2 has has "neither" component.
Some projects also have multiple conservation areas, and they might be of the same type. So I have a table like the following:
Project ID: Conservation Category:
1 Marine
1 Marine
1 Terrestrial
2 Neither
3 Terrestrial
3 Terrestrial
4 Marine
Sorry if that's hard to read - the first column is supposed to be numerical project ID's and the second shows which type of conservation category it has.
So I need to make a query that'll give me the number of projects with Marine, Terrestrial, Both, or Neither conservation categories. But I have no idea how to approach this, since I don't know how to get a query to recognize the "Both" condition.
The query should give the following result for the example above:
Conservation Category: Count:
Marine 2
Terrestrial 2
Both 1
Neither 1
Explanation: Project 1 and 4 have marine components. Projects 1 and 3 have terrestrial components. Only project 1 has both a marine and terrestrial component. Only project 2 has has "neither" component.