I need to get two summations in one query based on different criteria. Both criteria work in one column. Is there any way to do this?
I can best explain this with an example:
Table: salary_survey_result
Columns: industry, location, position, salary
In fact, I want to combine the following two queries:
SELECT industry, location, count(*) as MORE_THAN_SIX_FIGURE FROM salary_survey_result WHERE salary > 100000 GROUP BY industry, location
and
SELECT industry, location, count(*) as MORE_THAN_FIVE_FIGURE FROM salary_survey_result WHERE salary > 10000 GROUP BY industry, location
So, the result looks something like this:
industry location MORE_THAN_FIVE_FIGURE MORE_THAN_SIX_FIGURE
Healthcare NY 45 10 Healthcare MN 35 6 InfoTech NY 50 19 InfoTech MN 40 12
source share