Example: Query two tables

This query finds all open incidents for which your department is the service owner of the affected service:

var file = new SCFile("probsummary");
var sql = "select p.* from probsummary p LEFT OUTER JOIN device d ON (p.affected.item=d.logical.name) where d.owner=$lo.dept and p.flag=true";
var success = file.doSelect(sql);

while (success == RC_SUCCESS) 
{     
      print(file.affected_item)
      success = file.getNext();     
}