Jump to content
Fórum Script Brasil
  • 0

Join retornando mais que um valor


Uilson Claudio Filho

Question

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 to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      651.9k
×
×
  • Create New...