| Author |
Topic |
|
qutesanju
Posting Yak Master
193 Posts |
Posted - 2010-05-05 : 03:05:43
|
| I have one query SELECT [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] "Analysis ID",[MI Reliability Growth].LAST_UPDT_DT , "LAST_UPDT_DT"FROM [MI Reliability Growth]WHERE [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] IN ( '1022 Adhesive Nozzle KC #80311907 Nozzle, Hot Melt, Universal')SELECT [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] "Analysis ID",ISNULL( [MI Reliability Growth].LAST_UPDT_DT ,'0/0/1999 00:00:00:00') "LAST_UPDT_DT"FROM [MI Reliability Growth]WHERE [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] IN ( '1022 Adhesive Nozzle KC #80311907 Nozzle, Hot Melt, Universal')IS NULL(CAST ([MI Reliability Growth].LAST_UPDT_DT as varchar),''Unknown) "LAST_UPDT_DT"I have one query SELECT [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] "Analysis ID", [MI Reliability Growth].LAST_UPDT_DT "LAST_UPDT_DT"FROM [MI Reliability Growth]WHERE [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] IN ('1022 Adhesive Nozzle KC #80311907 Nozzle, Hot Melt, Universal', '1023 L20 KC #1514085 Module, Glue Applicator, Control Module', '1022 AC12 KC #145726 Module, Glue Applicator, 750 Elec', '1022 AC13 Tie, Die, Universal Summit Adhesive', '1022 AC7 Adhesive Nozzle', '1023-A322 KC#1454512 Nozzle Adaptor Nozzle, Adaptor - .018"HI', '1022 AC1 Adhesive Nozzle')which gives me Analysis_ID LAST_UPDT_DT1022 AC1 Adhesive Nozzle 5/4/20101022 AC7 Adhesive Nozzle 5/4/20101022 AC7 Adhesive Nozzle 5/4/2010I'm not sure why ot's giving me one row as pepeated and other values are now getting shown |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-05 : 03:23:24
|
Can you please be more clear on what is your problem?It seems like the output is showing the matching records to your where clause. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
qutesanju
Posting Yak Master
193 Posts |
Posted - 2010-05-05 : 04:32:42
|
| ok problem is it's not showing all 7 rows from where clause and in utput i can see 2nd and 3rd row is repeating |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-05 : 04:40:05
|
| that means you do have multiple records in [MI Reliability Growth] table for that value------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-05-05 : 05:05:55
|
and moreover might be MI_AN_ANALY_ID_CHR does not have all the 7 items which you have specified in where clause.quote: Originally posted by qutesanju ok problem is it's not showing all 7 rows from where clause and in utput i can see 2nd and 3rd row is repeating
Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
qutesanju
Posting Yak Master
193 Posts |
Posted - 2010-05-05 : 05:11:47
|
| ok if i set to choose distinct still it's showing me same resultthe query isSELECT distinct ( [MI Reliability Growth].[MI_AN_ANALY_ID_CHR]) "Analysis ID", [MI Reliability Growth].LAST_UPDT_DT "LAST_UPDT_DT"FROM [MI Reliability Growth]WHERE [MI Reliability Growth].[MI_AN_ANALY_ID_CHR] IN ('1022 Adhesive Nozzle KC #80311907 Nozzle, Hot Melt, Universal', '1023 L20 KC #1514085 Module, Glue Applicator, Control Module', '1022 AC12 KC #145726 Module, Glue Applicator, 750 Elec', '1022 AC13 Tie, Die, Universal Summit Adhesive', '1022 AC7 Adhesive Nozzle', '1023-A322 KC#1454512 Nozzle Adaptor Nozzle, Adaptor - .018"HI', '1022 AC1 Adhesive Nozzle') |
 |
|
|
qutesanju
Posting Yak Master
193 Posts |
Posted - 2010-05-05 : 05:12:58
|
| above query after applying distinct gives me which gives me Analysis_ID LAST_UPDT_DT-------------------- --------------------1022 AC1 Adhesive Nozzle 5/4/20101022 AC7 Adhesive Nozzle 5/4/20101022 AC7 Adhesive Nozzle 5/4/2010 |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-05-05 : 05:18:31
|
Please see my replyand comment on that....quote: Originally posted by qutesanju above query after applying distinct gives me which gives me Analysis_ID LAST_UPDT_DT-------------------- --------------------1022 AC1 Adhesive Nozzle 5/4/20101022 AC7 Adhesive Nozzle 5/4/20101022 AC7 Adhesive Nozzle 5/4/2010
Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
qutesanju
Posting Yak Master
193 Posts |
Posted - 2010-05-05 : 05:47:17
|
| ok i have one excel sheet which is having 60 rows and my above query ahows 51 rows ,i have to compare from excel sheet which rows are there in above query ,for that should i import excel records into one table and compare using MINUS opearotr?or is there any different option available? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-05 : 07:32:17
|
quote: Originally posted by qutesanju ok i have one excel sheet which is having 60 rows and my above query ahows 51 rows ,i have to compare from excel sheet which rows are there in above query ,for that should i import excel records into one table and compare using MINUS opearotr?or is there any different option available?
there's no MINUS operator in SQLyou need to use EXCEPT or LEFT JOIN or NOT EXISTS based on scenario.EXCEPT returns you distinct set of values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|