//first: find the tickets assigned to the user with status != waiting on user reply
$statement = $dbl->execute("SELECT ticket . * FROM ticket LEFT JOIN assigned ON ticket.TId = assigned.Ticket WHERE assigned.User = :user_id",array('user_id' => $user_id));
$assignedTo = $statement->fetchAll();
//second: find all non-assigned tickets forwarded to the support groups to which that user belongs
//TODO
//third: find all not assigned tickets that aren't forwarded yet.
//TODO: check if not forwarded to a group!
$statement = $dbl->executeWithoutParams("SELECT ticket . * FROM ticket LEFT JOIN assigned ON ticket.TId = assigned.Ticket WHERE assigned.Ticket IS NULL");
$notAssigned = $statement->fetchAll();
//forth: find all tickets assigned to someone else, not forwarded to a group or forwarded to a group you are a member from, with status == waiting on support and with timestamp of last reply > 1 day