troubleshooting Question

Updating "Extra" Records

Avatar of Clif
ClifFlag for United States of America asked on
Microsoft SQL Server
2 Comments1 Solution211 ViewsLast Modified:
This is sort of the reverse of a question I asked here:

I have a table which looks something like this:
Job    Phase      Cost
1234   ABC        123.45
1234   DEF        123.45
1234   GHI        123.45
5678   ABC        345.67
5678   DEF        345.67

Open in new window

What I need is an update query that will remove the extra cost leaving only one cost per job.  In other words, I need the result to look something like this:
Job    Phase      Cost
1234   ABC        123.45
1234   DEF        NULL
1234   GHI        NULL
5678   ABC        345.67
5678   DEF        NULL

Open in new window

I don't care which phase ends up with the cost (and which phases have their costs deleted), all I want is to have one cost per "Job" no matter how many phases each job has.

Although it probably shouldn't matter, the above is merely an example. The actual table has several other fields, none of which should be of any concern for this.

Contract ERP Admin/Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros