Delete records

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

In a table I have two columns that may sometimes hold the
same codes, for Example:

Col1 Col2
xxxx xxxx
yyyy zzzz
pppp pppp

I need to run a query that will update col1 to null where
the code is the same as what is in col2 so the rsult
would be:
Col1 Col2
xxxx
yyyy zzzz
pppp

How would I go about this...please help...really stuck
with this!

Thanks
 
Daniel,

Open a new query in design view, select the table and drag and drop the two
fields from the table down to the grid. Then in the grid, under Col2, type
[Col1] in the first criteria line (if the name of the filed is not Col1 then
type in tyhe exact name of the field). So far you have a Select query that
selects records where Col1 = Col2. Switch to datasheet view to verify. Then,
back to the design view, go to menu Query > Update query, to change the type
of your query from Select to Update. Notice the new line headed Update To
that appears in the grid. Go to that line under field Col1 and type in it
"Null" (without the quotes). Now go to menu Query > Run, confirm when
prompted to accept the cahnges, and you're done.

HTH,
Nikos
 
Back
Top