$sql = $sql . ' where ' . join(' and ', @where) if defined $where[0];