Click here to Skip to main content
15,885,546 members
Home / Discussions / Database
   

Database

 
AnswerRe: DB Desing Check Pin
Mycroft Holmes24-Mar-13 2:19
professionalMycroft Holmes24-Mar-13 2:19 
AnswerRe: DB Desing Check Pin
Richard MacCutchan24-Mar-13 2:29
mveRichard MacCutchan24-Mar-13 2:29 
QuestionSSRS Pin
engine123-Mar-13 1:35
engine123-Mar-13 1:35 
AnswerRe: SSRS Pin
Richard MacCutchan23-Mar-13 1:37
mveRichard MacCutchan23-Mar-13 1:37 
Questiontwo phase commit in sql Pin
Soiraian22-Mar-13 23:22
Soiraian22-Mar-13 23:22 
AnswerRe: two phase commit in sql Pin
Mycroft Holmes23-Mar-13 13:36
professionalMycroft Holmes23-Mar-13 13:36 
QuestionOLAP cube question (a) Edit Dimension and (b) Delete Partitiion Pin
devvvy21-Mar-13 16:07
devvvy21-Mar-13 16:07 
QuestionWant a query for for finding total number of non defected items. Pin
VishwaKL19-Mar-13 23:07
VishwaKL19-Mar-13 23:07 
Hi guys,

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



SQL
WITH months (num) as(
		SELECT 1
		UNION ALL 
		SELECT num+1
		FROM months
		WHERE num<12)SELECT m.num as Month,
							--isnull(t.count,0) as Total,
							isnull(t.resolved,0) as Totalresolved,  
							t.YearValue as YearData FROM months m
					left join (SELECT month(ProgramStartedDate) as Month,YEAR(ProgramStartedDate) as YearValue,
								--count(*) as count,
								
								
								
								sum(case when (ProgrammerStatus = 1 OR ReviewerStatus = 1)  THEN 1 ELSE 0 END)as resolved  
								FROM tb_ProgramCheckList 
								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' --AND month(ProgramStartedDate)=m.num  
								GROUP BY month(ProgramStartedDate),YEAR(ProgramStartedDate)



If any body help me to solve this issue will be appreciated,


Thanks and regards

VISHWA
AnswerRe: Want a query for for finding total number of non defected items. Pin
Corporal Agarn20-Mar-13 1:03
professionalCorporal Agarn20-Mar-13 1:03 
GeneralRe: Want a query for for finding total number of non defected items. Pin
VishwaKL20-Mar-13 18:05
VishwaKL20-Mar-13 18:05 
GeneralRe: Want a query for for finding total number of non defected items. Pin
Mycroft Holmes20-Mar-13 18:58
professionalMycroft Holmes20-Mar-13 18:58 
QuestionMS Sql normalization Pin
Per Söderlund19-Mar-13 21:40
Per Söderlund19-Mar-13 21:40 
AnswerRe: MS Sql normalization Pin
Jörgen Andersson20-Mar-13 0:14
professionalJörgen Andersson20-Mar-13 0:14 
GeneralRe: MS Sql normalization Pin
Per Söderlund20-Mar-13 0:20
Per Söderlund20-Mar-13 0:20 
AnswerRe: MS Sql normalization Pin
Eddy Vluggen20-Mar-13 1:38
professionalEddy Vluggen20-Mar-13 1:38 
AnswerRe: MS Sql normalization Pin
Jörgen Andersson20-Mar-13 2:34
professionalJörgen Andersson20-Mar-13 2:34 
GeneralRe: MS Sql normalization Pin
Per Söderlund20-Mar-13 3:01
Per Söderlund20-Mar-13 3:01 
GeneralRe: MS Sql normalization Pin
Jörgen Andersson20-Mar-13 4:07
professionalJörgen Andersson20-Mar-13 4:07 
GeneralRe: MS Sql normalization Pin
Per Söderlund20-Mar-13 4:38
Per Söderlund20-Mar-13 4:38 
GeneralRe: MS Sql normalization Pin
Jörgen Andersson20-Mar-13 4:45
professionalJörgen Andersson20-Mar-13 4:45 
GeneralRe: MS Sql normalization Pin
Per Söderlund20-Mar-13 11:51
Per Söderlund20-Mar-13 11:51 
GeneralRe: MS Sql normalization Pin
Jörgen Andersson20-Mar-13 21:24
professionalJörgen Andersson20-Mar-13 21:24 
GeneralRe: MS Sql normalization Pin
Per Söderlund22-Mar-13 10:48
Per Söderlund22-Mar-13 10:48 
GeneralRe: MS Sql normalization Pin
Eddy Vluggen20-Mar-13 8:14
professionalEddy Vluggen20-Mar-13 8:14 
GeneralRe: MS Sql normalization Pin
Jörgen Andersson20-Mar-13 9:49
professionalJörgen Andersson20-Mar-13 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.