hi there, have a query with building an SQL query...
SELECT DISTINCT(e.id),cs2.company_id as companyid, count(es2.skill) as skillswanted FROM employees_personal e INNER JOIN employees_skills es2 on es2.employee_id = e.id INNER JOIN company_skill cs2 on cs2.skill = es2.skill WHERE cs2.company_id = '117' AND 1 GROUP BY companyid order by skillswanted DESC, e.first_name,e.last_name Basically... Employees_personal have skills in the employees_skills table, Companies have skills they require in company_skill table i want to find all employees who have skills that match skills in the company skill table, and then order by the number of matches desc to find most suitable employee. ... currently the query is not giving any errors, but it only returns one employee, when I know there should be alot more results... also...ideally would like to create a HAVING clause on the number of skillswanted...so can say only display employees who match at least 2 skills. thanks..for any help would be appreciated... -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
