select * from (
SELECT ROW_NUMBER() OVER(
ORDER BY i.id DESC
) as row_num,
p.pkey || '-' || i.issuenum as Chave_Issue,
i.ISSUENUM Num_Issue,
i.CREATED as Issue_CREATED,
i.SUMMARY,
dbms_lob.substr(i.DESCRIPTION,4000,1) DESCRIPTION,
i.PRIORITY,
s.pname Status_Atual,
s.SEQUENCE,
i.UPDATED,
i.DUEDATE,
(SELECT RS.PNAME FROM RESOLUTION RS WHERE RS.ID = i.RESOLUTION) AS PNAME_RESOLUTION,
i.RESOLUTIONDATE,
i.TIMESPENT,
i.WORKFLOW_ID,
i.COMPONENT,
p.PNAME,
ci.GROUPID,
CAST(ci.OLDSTRING as varchar(100)) status_antigo,
CAST(ci.NEWSTRING AS varchar(100)) status_novo,
cg.CREATED Data_Status,
(SELECT iss.PNAME FROM issuetype iss WHERE iss.ID = i.issuetype) AS Issue_Type,
cg.author,
--cwd.user_name,
--cwd.Display_name,
--cwd.email_address,
--CAST(te.TITLE as varchar(200)) title_team,
(SELECT NUMBERVALUE FROM CUSTOMFIELDVALUE cfv WHERE CUSTOMFIELD in (select CF.id from customfield CF where CF.CFNAME = 'Size (PFS)') AND cfv.issue = I.ID) AS PFS
--(SELECT round(sum(wl.timeworked) /60. /60.,2) FROM worklog wl WHERE wl.author = ui.USER_KEY) as Horas_Apontadas
FROM changeitem ci
inner join changegroup cg on ci.groupid = cg.id AND ci.FIELDTYPE='jira' AND ci.FIELD='status'
inner join jiraissue i on cg.issueid = i.id and i.issuetype in (SELECT id FROM ISSUETYPE WHERE pname IN ('Defect','Epic','Improvement', 'New Feature','Non Functional','Story')) and i.RESOLUTIONDATE is not NULL
inner join project p on i.project = p.id
inner join issuestatus s on s.id = i.issuestatus
inner JOIN APP_USER app ON app.user_key = cg.author
WHERE i.CREATED >= to_date('2023-01-01', 'YYYY-MM-DD')
ORDER BY i.ISSUENUM,cg.CREATED
) where row_num BETWEEN 1 and 1000
Porem quando coloco esse join a mais ele duplica os registros:
inner JOIN AO_AEFED0_USER_INDEX ui ON ui.user_key = app.user_key
Como posso resolver isso, pois preciso que esse join seja executado junto a query
Pergunta
Uilson Claudio Filho
Galera tenho essa query
select * from ( SELECT ROW_NUMBER() OVER( ORDER BY i.id DESC ) as row_num, p.pkey || '-' || i.issuenum as Chave_Issue, i.ISSUENUM Num_Issue, i.CREATED as Issue_CREATED, i.SUMMARY, dbms_lob.substr(i.DESCRIPTION,4000,1) DESCRIPTION, i.PRIORITY, s.pname Status_Atual, s.SEQUENCE, i.UPDATED, i.DUEDATE, (SELECT RS.PNAME FROM RESOLUTION RS WHERE RS.ID = i.RESOLUTION) AS PNAME_RESOLUTION, i.RESOLUTIONDATE, i.TIMESPENT, i.WORKFLOW_ID, i.COMPONENT, p.PNAME, ci.GROUPID, CAST(ci.OLDSTRING as varchar(100)) status_antigo, CAST(ci.NEWSTRING AS varchar(100)) status_novo, cg.CREATED Data_Status, (SELECT iss.PNAME FROM issuetype iss WHERE iss.ID = i.issuetype) AS Issue_Type, cg.author, --cwd.user_name, --cwd.Display_name, --cwd.email_address, --CAST(te.TITLE as varchar(200)) title_team, (SELECT NUMBERVALUE FROM CUSTOMFIELDVALUE cfv WHERE CUSTOMFIELD in (select CF.id from customfield CF where CF.CFNAME = 'Size (PFS)') AND cfv.issue = I.ID) AS PFS --(SELECT round(sum(wl.timeworked) /60. /60.,2) FROM worklog wl WHERE wl.author = ui.USER_KEY) as Horas_Apontadas FROM changeitem ci inner join changegroup cg on ci.groupid = cg.id AND ci.FIELDTYPE='jira' AND ci.FIELD='status' inner join jiraissue i on cg.issueid = i.id and i.issuetype in (SELECT id FROM ISSUETYPE WHERE pname IN ('Defect','Epic','Improvement', 'New Feature','Non Functional','Story')) and i.RESOLUTIONDATE is not NULL inner join project p on i.project = p.id inner join issuestatus s on s.id = i.issuestatus inner JOIN APP_USER app ON app.user_key = cg.author WHERE i.CREATED >= to_date('2023-01-01', 'YYYY-MM-DD') ORDER BY i.ISSUENUM,cg.CREATED ) where row_num BETWEEN 1 and 1000
Porem quando coloco esse join a mais ele duplica os registros:
inner JOIN AO_AEFED0_USER_INDEX ui ON ui.user_key = app.user_key
Como posso resolver isso, pois preciso que esse join seja executado junto a query
Obrigado
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.