Is it bad practice to execute this query in a for or foreach-loop?

The department_activity table will get clean every 8th or 9th day, so everything older than 9 days is deleted from the list.

Ahhh…ok. I am not the SQL expert, but maybe this will give you an idea on a direction?

SELECT c.id “ClientId”, c.name “ClientName”, d.name “DepartmentName”
FROM clients c, department_activity da, departments d
WHERE da.object_id = c.id AND da.department_id = d.id AND da.object_type = ‘client’;

Or something to that effect.

Scott

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.