I am having some problems with an update query
I have the table (equip_comp) below
Location Equipment Problem Company ID
1001 Drill Power ABC Corp 1
1001 Drill Breakage ABC Corp 2
1001 Saw Blunt XYZ Corp 3
1001 Saw Misc NONE 4
1002 Drill Power AAA Corp 5
1002 Drill Breakage NONE 6
1002 Saw Blunt BBB Corp 7
1002 Saw Misc NONE 8
I wish to update my table so that where company=NONE then the existing Company for that LOCATION+EQUIPMENT replaces the NONE. For example at I want the company at row identified 1001+SAW to be XYZ.
I need one query that will look at the existing location + location where it finds a company=NONE, and use the existing non “NONE” company to update the “NONE”. The location+equipment determines the company.
I assume I am looking at something like
Update equip_comp set (select distinct compant …..???)
Thanks