1
I need that in this query come only records where the ABC CURVE column is different from the MODEL column.
For example, this customer the ABC curve of it is silver and the model is diamond/gold, so it is noticed that the name silver is not found in the field model.
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
Where CurvaABC <> Modelo
?– Jéf Bueno
It would be more like a like. In the column Curve ABC, has the name silver, however, this name silver is not in the column model. Understood?
– Renan Bessa
Not exists https://technet.microsoft.com/pt-br/library/ms184297(v=sql.105). aspx , I believe solves
– Motta
Comparisons using string may not be practical. There is no way to match tables
CurvaABC
andModeloCriticidade
, using the columnsCurvaID
andMcID
?– José Diz