I need to do a select with JOIN
on two tables but I can not group to not repeat the rows. Here is the SQL expression:
SELECT
Andamento.NumeroProcesso,
Andamento.Chave,
Andamento.Codigo,
Andamento.DataAnda,
Andamento.Andamento,
Andamento.AdvogadoID
FROM Andamento FULL OUTER JOIN Processo
ON Andamento.NumeroProcesso = Processo.NumeroProcesso
WHERE (Processo.Irrecuperavel = 1) AND (DATEDIFF(MONTH,
Andamento.DataAnda,GETDATE()) >= 6)
When I try the clause:
GROUP BY Andamento.NumeroProcesso
I get the following error:
The column 'Progress.Chave' is invalid in the selection list because it is not contained in an aggregate function or in the
GROUP BY