implement main alert query