1
I am very new with SQL and I am creating an application that brings the number of hours contracted, well the part that I have doubts in the query is the index of lines...
I need the rows not to repeat the code from table 1 and the items from table 2 disappear.
My code is this:
SELECT tabela1.codigo_tabela2, SUM(tabela1.itens), tabela2.nome, tabela2.codigo
FROM tabela1, tabela2
WHERE tabela1.codigo_tabela2 = tabela2.codigo AND tabela1.ativo = b'1' AND tabela1.usuario = x
Well, I hope you can help me... I couldn’t find anything in my research, (it’s very specific).
Thanks, I didn’t know that statement "GROUP BY". :D Ah! I removed the code2 from SELECT, but kept it in GROUP BY @mxix
– VitorLuizC