0
I need to select the following:
'SELECT TR.CODPARC, TR.NOMEPARC, TB.CODVEND, TV.APELIDO, TV.AD_CARTAOCAMP, TP.AD_CAMPLENTE, TP.AD_CAMPPONTOS
FROM TGFCAB TB, TGFITE TE, TGFPRO TP, TGFPAR TR, TGFVEN TV
Where Tb.Nunota = Te.Nunota
AND TB.CODVEND = TV.CODVEND
AND TP.CODPROD = TE.CODPROD
AND TB.CODPARC = TR.CODPARC
And Tb.Tipmov = 'P'
AND TB.CODTIPOPER IN (3100, 3102, 3105)
AND TB.DTNEG >= :PERIODO.INI
AND TB.DTNEG <= :PERIODO.FIN
AND TV.AD_CARTAOCAMP IS NOT NULL
ORDER BY TB.KLKCLBOSE'
Bringing a line only with the result of
'SELECT TR.CODPARC, TR.NOMEPARC, TB.CODVEND, TV.APELIDO, TV.AD_CARTAOCAMP'
That will be exactly equal and the sum of the fields TP.AD_CAMPLENTE, TP.AD_CAMPPONTOS
on the same line.
To help you faster, put an example of data entry http:/sqlfiddle.com/ and the expected output here in the question.
– Tiedt Tech
makes group by those fields
– Ricardo Pontual
Doing group by of TR.CODPARC, TR.NOMEPARC, TB.CODVEND, TV.NICKNAME, TV.AD_CARTAOCAMP says that it is not a group by and putting distinct operation does not accept select.
– Leonardo