I am very new to 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 the lines ...
I need the rows to not repeat the code from table 1 and add the items from table 2.
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 could not find anything in my research, (it's very specific).