Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting non-Distinct (Duplicate) Records using 2 fields

Status
Not open for further replies.

LMGroup

MIS
Apr 10, 2006
85
CA
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:

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!
 
It's on the Query Designer toolbar beside the Execute button. I took a screen shot of it, but I don't know where to put it to use the img tag.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top