I'm starting to study on the old JasperSoft Studio platform iReports and I'm having trouble creating the query t-sql exit duplicate.
I have this query:
SELECT
F2_CLIENTE,
F2_LOJA,
A1_NOME,
A1_CGC,
A1_INSCR,
F2_DOC,
F2_SERIE,
F2_PLIQUI,
F2_PBRUTO,
D2_ITEM,
D2_COD,
D2_QUANT,
B1_DESC,
D2_LOCAL,
B1_POSIPI,
C6_PEDCLI,
C6_ITEMCLI,
C6_NUM,
D2_PEDIDO,
C6_ITEM,
D2_ITEMPV,
D2_DOC,
C6_NOTA
FROM dbo.SF2010 AS SF2
INNER JOIN dbo.SD2010 AS SD2
ON SF2.F2_DOC = SD2.D2_DOC
AND SF2.F2_SERIE = SD2.D2_SERIE
AND SF2.F2_CLIENTE = SD2.D2_CLIENTE
AND SF2.F2_LOJA = SD2.D2_LOJA
INNER JOIN dbo.SB1010 AS SB1
ON SD2.D2_COD = SB1.B1_COD
AND SD2.D2_LOJA = SB1.B1_LOCPAD
INNER JOIN dbo.SA1010 AS SA1
ON SF2.F2_CLIENTE = SA1.A1_COD
AND SF2.F2_LOJA = SA1.A1_LOJA
INNER JOIN dbo.SC6010 AS SC6
ON SD2.D2_PEDIDO = SC6.C6_NUM
AND SD2.D2_ITEMPV = SC6.C6_ITEM
AND SD2.D2_DOC = SC6.C6_NOTA
AND SD2.D2_SERIE = SC6.C6_SERIE
WHERE
F2_DOC = '000015051' AND F2_SERIE ='2'
AND SF2.D_E_L_E_T_ != '*'
AND SD2.D_E_L_E_T_ != '*'
AND SB1.D_E_L_E_T_ != '*'
AND SA1.D_E_L_E_T_ != '*'
AND SC6.D_E_L_E_T_ != '*'
ORDER BY SF2.F2_DOC
In the return database only one record in Jasper Studio returns three duplicate records.