I need this query to come only with records where the CURVE ABC column is different from the MODEL column.
For example, this customer's ABC curve is silver and the model is diamond / gold, so it turns out that the name silver is not in the model field.
SELECT
C.UsuID [Código],
U.UsuNome [Cliente],
P.ProNome [Produto],
M.MCDescricao [Modelo],
M.MCId [ID_Modelo],
A.Descricao [Curva ABC],
A.CurvaID [ID_Curva]
FROM Usuario U
INNER JOIN ParametroProdutoCliente PPC ON U.UsuID = PPC.UsuID
INNER JOIN ComplementoColunas C ON U.UsuID = C.UsuID AND C.LinhaID = 1
AND C.CompID = 32
AND C.ColunaID = 12
LEFT JOIN CurvaABC A ON A.CurvaID = U.CurvaID
INNER JOIN Usuario AU ON AU.UsuID = c.ColunaValor
JOIN ProdutoUsuario PU ON U.UsuID = PU.UsuID
JOIN Produto P ON PU.ProID = P.ProID
JOIN ModeloCriticidade M ON PU.MCId = M.MCId AND PU.ProID = M.ProID
WHERE U.EmpLiberada = 1 AND U.UsuTipo = 'C' AND PPC.ProID in(2,5,12)
AND U.UsuID = 316
The result is this way:
Cliente Produto Modelo ID_Modelo Curva ABC
ChilliBeans Conciliador e-Extrato Diamante|Ouro 23 PRATA