Skip to content
Advertisement

Field value counts with aggregate conditions

Suppose I have the following applicant data for jobs in a company:

The budget is 40000 and the preference is to hire senior managers. What PostgreSQL constructs do I use to get the following result as far as the number of hires are concerned.

Any directions would be appreciated.

Here is a starting sqlfiddle: http://sqlfiddle.com/#!17/2cef4/1

Advertisement

Answer

Using PostgreSQL filters and window functions, I was able to come up with a query that produced the result.

Example: http://sqlfiddle.com/#!17/2cef4/10

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement