How to use having together with view in sql server

1

When trying to use HAVING in a SQL query is returning the following error:

Mensagem 8121, Nível 16, Estado 1, Linha 15
Column 'V_DADOSFUNC.FILIAL' is invalid in the HAVING clause because it is not contained in either an aggregate function or the
GROUP BY clause.
    
asked by anonymous 18.10.2016 / 20:23

1 answer

2

Hello, Add the column V_DATAFUNC.FILIAL in a GROUP BY:

GROUP BY V_DADOSFUNC.FILIAL, <<demais colunas>>
    
18.10.2016 / 20:40