Select statement within the select statment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • petev
    New Member
    • Sep 2010
    • 1

    Select statement within the select statment

    Below is a statement that give me the results as follows:
    --------------------
    Tester | Total_Target_Cy cle
    tester1 | 5
    tester2 | 6

    I am trying to figure out how i can get total_defects column with only open defects only and percent changet between the target cycle and total defects.

    ------------------------------------------------------
    Tester | Total_Target_Cy cle | Total_Defects| % Change
    ------------------------------------------------------
    tester1 | 5
    tester2 | 6


    HOW TO COMBINE THE TWO STATEMENTS BELOW. THANKS

    select BG_detected_by Tester,COUNT(*) Total_Target_Cy cle
    From Bug
    where BG_STATUS = 'Open'and BG_TARGET_RCYC IS NOT NULL
    GROUP by BG_DETECTED_BY, BG_STATUS,BG_TA RGET_RCYC

    select bg_detected_by tester, count(*) Total
    from bug
    where bg_status = 'Open'
    group by bg_status,bg_de tected_by
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Try this:

    [code=oracle]
    SELECT tester,total_ta rget_cycle,(SEL ECT COUNT(*) FROM bug where bg_detected_by = x.tester AND bg_status = 'Open') total FROM
    (select BG_detected_by Tester,COUNT(*) Total_Target_Cy cle
    From Bug
    where BG_STATUS = 'Open'and BG_TARGET_RCYC IS NOT NULL
    GROUP by BG_DETECTED_BY, BG_STATUS,BG_TA RGET_RCYC)
    [/code]

    Comment

    Working...