Good Morning everyone!
I have a pretty straight forward query:
On the left outer join:
I need it to join on:
but it doesn't like
any ideas?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
I have a pretty straight forward query:
Code:
SELECT NULL as ID,
NULL as Parent_ID,
c.CY_CYCLE as 'Name',
NULL as 'Start Date',
NULL as 'End Date',
isnull(bga.cnt,0) as 'Active Defects',
round(cast(isnull(tcp.cnt,0) as float)/cast(isnull(tc.cnt,1) as float)*100,2) as '% Complete',
c.CY_USER_07 as Primary_Ident,
r.Rel_Name as Secondary_Ident
FROM [RELEASES] r,[RELEASE_CYCLES] rc,[CYCLE] c
LEFT OUTER JOIN (select tc.tc_cycle_ID, COUNT(*) as CNT FROM [TESTCYCL] tc
WHERE tc.TC_STATUS is not null
and tc.TC_CYCLE_ID is not null
and tc.TC_STATUS <> 'N/A'
and tc.TC_STATUS <> 'Deferred'
GROUP BY tc.tc_cycle_ID) as tc
on c.CY_CYCLE_ID = tc.tc_cycle_ID
LEFT OUTER JOIN (select tcp.tc_cycle_ID, COUNT(*) as CNT FROM [TESTCYCL] tcp
where tcp.TC_STATUS = 'Passed'
GROUP BY tcp.tc_cycle_id) as tcp
on c.CY_CYCLE_ID = tcp.tc_cycle_ID
LEFT OUTER JOIN (select bga.bg_detected_in_rcyc, bga.BG_DETECTED_in_rel, bga.BG_PROJECT, COUNT(*) as CNT from [BUG] bga
where bga.BG_STATUS not in ('New', 'Invalid', 'Deferred', 'Closed')
AND bga.BG_USER_17 = 'Defect'
group by bga.bg_detected_in_rcyc, bga.bg_detected_in_rel, bga.bg_project) as bga
on c.CY_ASSIGN_RCYC = bga.BG_DETECTED_IN_RCYC
and c.CY_USER_07 = bga.BG_PROJECT
WHERE r.REL_ID = rc.RCYC_PARENT_ID
and rc.RCYC_ID = c.CY_ASSIGN_RCYC
and c.CY_USER_07 = 'PRJ-02396 2011 - Retail HP & Sub Portal'
Group By c.CY_USER_07 , r.REL_NAME , rc.rcyc_name, c.CY_CYCLE, tc.cnt, tcp.cnt, bga.cnt
On the left outer join:
Code:
LEFT OUTER JOIN (select bga.bg_detected_in_rcyc, bga.BG_DETECTED_in_rel, bga.BG_PROJECT, COUNT(*) as CNT from [BUG] bga
where bga.BG_STATUS not in ('New', 'Invalid', 'Deferred', 'Closed')
AND bga.BG_USER_17 = 'Defect'
group by bga.bg_detected_in_rcyc, bga.bg_detected_in_rel, bga.bg_project) as bga
on c.CY_ASSIGN_RCYC = bga.BG_DETECTED_IN_RCYC
and c.CY_USER_07 = bga.BG_PROJECT
I need it to join on:
Code:
on c.CY_ASSIGN_RCYC = bga.BG_DETECTED_IN_RCYC
and c.CY_USER_07 = bga.BG_PROJECT
and r.rel_id = bga.BG_DETECTED_IN_REL
but it doesn't like
Code:
r.rel_id
any ideas?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008