Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2011-09-18 : 07:02:29
|
| select distinct JobID,fkErrorInfoCode from ImportJobError, ImportJob,ErrorMasterwhere fkJobID = JobIDand ErrorInfoCode = fkErrorInfoCodeand ErrorMaster.ermMessageType ='ERR'order by JobIDHere i am getting Result as JobID fkErrorInfoCodesb001634 VLD_49077sb001635 VLD_49077sb001635 VLD_51041sb001636 VLD_49077sb001637 VLD_49077sb001638 VLD_49077sb001639 VLD_49077sb001640 VLD_49077sb001640 VLD_51041sb001641 VLD_49077sb001642 VLD_49077sb001643 VLD_49077sb001644 VLD_49077sb001645 VLD_49077Now what I wanted is to just show result where there is only one possible Error LikeJobID fkErrorInfoCodesb001634 VLD_49077sb001636 VLD_49077sb001637 VLD_49077sb001638 VLD_49077sb001639 VLD_49077sb001641 VLD_49077sb001642 VLD_49077sb001643 VLD_49077sb001644 VLD_49077sb001645 VLD_49077Kamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-18 : 08:12:26
|
| [code]select JobID,fkErrorInfoCodefrom(select COUNT(1) OVER (PARTITION BY JobID) AS Occur,JobID,fkErrorInfoCodefrom(select distinctJobID,fkErrorInfoCode from ImportJobError, ImportJob,ErrorMasterwhere fkJobID = JobIDand ErrorInfoCode = fkErrorInfoCodeand ErrorMaster.ermMessageType ='ERR'order by JobID)t)pWHERE Occur=1[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2011-09-18 : 12:07:27
|
| Thanks visakhKamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-18 : 12:58:52
|
welcome ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|