Maybe thisSELECT COUNT(Jobs.JobId)over(partition by Jobs.JobId)AS occurances, Jobs.JobId, Jobs.JobTitle, JobAttributes.AttId, Attributes.AttMasterFROM Jobs INNER JOIN JobAttributes ON Jobs.JobId = JobAttributes.JobIdINNER JOIN Attributes ON JobAttributes.AttId = Attributes.AttIdWHERE Attributes.AttMaster=404 GROUP BY Jobs.JobId, Jobs.JobTitle, Attributes.AttMaster, JobAttributes.AttIdORDER BY occurances DESC
If not then please post some sample data.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH