I'm trying to select records from a table where there is no key. I'm using SQL Server 2005. Because of some data entry errors, I need to isolate all the records where they have entered StatusCode 90099 for the same JobN and then I need to change all but the last occurrence of the StatusCode to 90099 for each JobN this occurs in.
This seems to give me the records, but I can't see or change them:
Thanks for your help!
This seems to give me the records, but I can't see or change them:
Code:
SELECT JobN, StatusCode, COUNT(StatusCode) AS StatNum
FROM JobStatus1
WHERE (StatusCode = 90099)
GROUP BY JobN, StatusCode
HAVING (COUNT(StatusCode) > 1)
ORDER BY JobN
Thanks for your help!