Here is the original query that I have to change:
$qualified_query = “SELECT * FROM contacts AS c INNER JOIN skills as s ON s.skill_id=c.skill_id “.$crit.” AND s.type=‘0’ AND c.agent_time >= ‘60’”;
$qualified_contacts = $db->query($qualified_query);
$qualified_contacts_rows = $qualified_contacts->num_rows;
We are having to remove this part: c.agent_time >= ‘60’. Now, we have a column in my skills table called “threshold” and we need to find if it is <= against either the agent_time or the total_time columns in the contacts table. I have added a column to the skills table called time_class (couldn’t figure anything better to call it) which has a 0 that needs to point it to c.agent_time 1 for c.total_time.
Can someone help me come up with a query for this?