function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Charlone Gianan 1Charlone Gianan 1 

How to group query results based on the number of filters matched?

Hello. Can you guys help me how can I group query results based on the number of filters matched. 
For example, I have 5 filters then I am looking for (5 skills), 'Apex' , 'Lightning' , 'Visualforce', 'HTML' and 'Java'. These skills is from lookup relataionship(Employee_Skills__c) to Contact(renamed - Employee). 

The result should display in a table like this.
5 matches out of 5 filters
4 matches out of 5 filters
3 matches out of 5filters
2 matches out of 5 filters
1 match out of 5 filters

Here's my soql:
SELECT Name, Email, (SELECT Skill_ID__r.Name, Proficiency__c, Year_of_Experience__c FROM Employee_Skills__r), (SELECT Training_ID__r.Name FROM Employee_Training__r), (SELECT Certification_ID__r.Name FROM Employee_Certifications__r) FROM Contact