I have a table with many item_number records which are duplicates within my table and the other columns within the table for each item_number are blank.
All of the records within the table are under product group of g024. However when I run my query it will update all of my items numbers with this.
What I want it to do is for each item_number only populate resource code, operation and operation description only once and not populating the remianing blank fields for each item_number with the criteria within the query.
I will populate these other black fields with a different update query later on.
UPDATE resource1 SET [resource code] ='TOOLASSY', OPERATION = '10', OPERATION_DESCRIPTION = 'MOULD TOOL ASSEMBLY'
WHERE [product group]="G024"
I did try something like this to make the query only update each item_number only once. I looked into the TOP keyword but not sure if it was on the right line or not.
I need something like the DISTINCT keyword within a sub query for an update query.
UPDATE resource1 SET [resource code] ='TOOLASSY', OPERATION = '10', OPERATION_DESCRIPTION = 'MOULD TOOL ASSEMBLY'
WHERE [product group]="G024" AND ITEM_NUMBER IN(SELECT TOP 1 ITEM_NUMBER FROM RESOURCE1)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…