Example: Query more than two files

This query finds all open incidents that are assigned to my department:

var file = new SCFile("probsummary");
var sql = "SELECT ta01.*, ta03.dept.name AS dept.name FROM probsummary ta01 LEFT OUTER JOIN operator ta02 LEFT OUTER JOIN contacts ta03 ON  ( ta02.contact.name = ta03.contact.name )  ON  ( ta01.assignee.name = ta02.name )  WHERE ( ta01.flag = true and ta03.dept.name=$lo.dept)";
var success = file.doSelect( sql ) ;
while (success == RC_SUCCESS)
{
      success = file.getNext();
      
}