I have 2 tables Table1,Table2
Table1 having products and serial number information, and Table2 having set of 32 check points to say that product having defect or not, i want to get only total number of non defected products for each month,
say example i have 3 products in march month and only 2 products satisfy set of 32 check points and having non defect, so for this problem result will be Total Number of non defected product will be 2. i want this in query.
I tried it but it giving each product defect count, i want only total number of non defect product
here is my query
WITH months (num) as(
WHERE num<12)SELECT m.num as Month,
isnull(t.resolved,0) as Totalresolved,
t.YearValue as YearData FROM months m
left join (SELECT month(ProgramStartedDate) as Month,YEAR(ProgramStartedDate) as YearValue,
sum(case when (ProgrammerStatus = 1 OR ReviewerStatus = 1) THEN 1 ELSE 0 END)as resolved
LEFT JOIN dbo.tb_ProgramDetails on
tb_ProgramDetails.ProgramID =tb_ProgramCheckList.ProgramID AND tb_ProgramDetails.Version=tb_ProgramCheckList.VersionID
WHERE ProgramStartedDate >='10/1/2012'
and ProgramStartedDate <'10/01/2013'
GROUP BY month(ProgramStartedDate),YEAR(ProgramStartedDate)
If any body help me to solve this issue will be appreciated,
Thanks and regards
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.