my $sql = " SELECT incident.id AS i_id, incident.severity, incident.summary, action.id AS a_id, action.incident_id, action.description, action.notes FROM incident, action WHERE incident.id = action.incident_id AND action.due_date > $date (a specified date) AND action.due_date < current_date() ORDER BY sort_date ASC " $sth->prepare($sql); $sth->execute(); while (my $href =$sth->fetchrow_hashref()) { my $details={}; $details->{'Incident ID'} = $$href{'i_id'}; $details->{'Action ID'} = $$href{'a_id'}; $details->{'Severity'} = $$href{'severity'}; $details->{'Summary'} = $$href{'summary'}; and so on... push(my @results, $details); } return @results