• when I ran the below query

    I got this error

    Msg 8121, Level 16, State 1, Line 12

    Column 'SalesOrder.DateEntered' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause.