2
Hello
I think you stuck at problem of date
Please attach query and find solution below , it wll surely help you :
https://blog.sqlauthority.com/2012/06/03/sql-server-fix-error-147-an-aggregate-may-not-appear-in-the-where-clause-unless-it-is-in-a-subquery-contained-in-a-having-clause-or-a-select-list-and-the-column-being-aggregated-is-an-outer-refer/
Thanks