Skip to content
Advertisement

MySQL return total COUNT of each value in a column

I have a table of jobseekers with three columns

Each jobseeker could have different hiring status for each employer depending on the interview. Now I want to return the COUNT of each total HIRING STATUS But it should only count the jobseeker’s highest hiring status.

Say that John was ranked as QUALIFIED by employer 1 and HIRED by employer 2 John will only be counted under the highest hiring status he got which is HIRED by employer 2 and must not be counted under QUALIFIED.

Here is my table

and the result I want is

Thank you, sorry for bad English.

Advertisement

Answer

You need a LEFT join of the table hStatus_table to a query that returns the minimum integer hiringstatus of each jobseekerid:

I assume that the table hStatus_table is like this:

See the demo.
Results:

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